Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select x as y Recordset Problem

Status
Not open for further replies.

nzgirl

Programmer
Feb 26, 2003
72
NZ
Hi....
I create a Recordset with a "select, a.x, b.x as y from table1 a join table2 b on a.c = b.c"
then I want to display both x and y
but although response.write(rs.fields("x")) works fine
response.write(rs.fields("y")) doesn't.

any pointers?
Thanks
:)
 
Should work except select, probably a typo as this would cause the query to fail.

maybe b.x contains a null ?
 
Thanks for the feedback!
select, is a mistype I do mean select
I've tried the query in query analyser and it runs fine....
But 1) I'm not sure how to view the results of a recordset except field by field and 2) I think the AS part might not do what I'm expecting...
I wasn't sure whether to put this in the ASP or SQL forum :-(

:)
 
I dont know about the asp but the sql looks correct and if you were using VB thats how you would refer to the returned field. Technically you should use rs.fields.item("y")

The AS basically names the returned field y instead of the field name within the table.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top