SQL Query using ADO connection (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


JohnH -> SQL Query using ADO connection (4/23/2008 10:53:46)

This is probably a really easy one (I am hoping!)

Can someone tell me why my SQL query is only returning the first record? I have 85 rows of data in the table.

<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=xxx;UID=xxx;PWD=xxx;DATABASE=xxx"

Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from trans"
rs.open SQL, conn

response.write rs("REQ_ID")

rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%>


Thanks John




rdouglass -> RE: SQL Query using ADO connection (4/23/2008 11:18:02)

There isn't a loop in there. Try something like this:

...
rs.open SQL, conn

do while NOT rs.EOF
response.write rs("REQ_ID")
rs.MoveNext
loop

rs.close
...


See what I did?




JohnH -> RE: SQL Query using ADO connection (4/25/2008 6:37:37)

Thanks rdouglas.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
4.699707E-02