Thanks for explaining the precision and scale. I was a little unsure about
it, that's why I didn't reply to it.
The CompanyName field actually displays a numeric value that corresponds to
the ID field. I appreciate all of the information you have provided and I'm
sorry to have taken up much of your time. I think I'll just put this project
on hold for now.
Thanks again.
Well, when you get back to it, here is a view and stored procedure that
accepts a school and/or a parish returns all the user fields whose names
you provided:
CREATE VIEW SchoolsUsers AS
SELECT s.Parish, s.School, s.Principal, s.address SchoolAddress, s.city
SchoolCity, s.zip SchoolZip,
u.ID UserID, firstname, lastname, u.address UserAddress, u.city
UserCity, u.CompanyName
FROM DB1..Schools s inner join DB2..Users u
ON s.ID = CAST(u.CompanyName AS INT)
go
CREATE PROCEDURE DB2..GetUsersBySchoolorParish (
@School nvarchar(255)
,@Parish nvarchar(255)) AS
SET NOCOUNT ON
IF @School > '' AND @Parish > ''
SELECT UserID, firstname, lastname,UserAddress,UserCity,CompanyName
FROM SchoolsUsers
WHERE Parish = @Parish AND School = @School
ELSE
BEGIN
IF @School > ''
SELECT UserID, firstname, lastname,UserAddress,
UserCity,CompanyName
FROM SchoolsUsers
WHERE School = @School
ELSE
SELECT UserID, firstname, lastname,UserAddress,
UserCity,CompanyName
FROM SchoolsUsers
WHERE Parish = @Parish
END
To retrieve results from this in ASP, i would do this:
<%
dim cn, rs, school, parish, sHTML, fld
school = Request.Form("school") ' or Querystring
parish= Request.Form("parish") ' or Querystring
set cn=createobject("adodb.connection")
cn.open "provider=sqloledb;data source=sqlservername;" & _
"user id = xxxxx;password=xxxxx;initial catalog=DB2"
set rs=createobject("adodb.recordset")
cn.GetUsersBySchoolorParish school, parish, rs
if not rs.eof then
sHTML = "<table><tr>"
for each fld in rs.fields
sHTML=sHTML & "<th>" & fld.name & "</th>"
next
sHTML=sHTML & "</tr><tr><td>"
sHTML = sHTML & _
rs.GetString(,,"</td><td>","</td></tr><tr><td>")
sHTML = left(sHTML,len(sHTML) - 8) & "</table>"
response.write sHTML
else
response.write "no users returned"
end if
%>
> Thanks for explaining the precision and scale. I was a little unsure
> about it, that's why I didn't reply to it.
[quoted text clipped - 55 lines]
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.

Signature
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
dusty - 12 Mar 2008 17:00 GMT
Hey, thanks for the time and effort you've put in to help me Bob. This code
will definitely help me.
> Well, when you get back to it, here is a view and stored procedure that
> accepts a school and/or a parish returns all the user fields whose names
[quoted text clipped - 115 lines]
> >> header is my spam trap, so I don't check it very often. You will get
> >> a quicker response by posting to the newsgroup.