ADO Connection

  • Hi all,

    I'm just creating an ADO connection using sql server.  But getting an error which i have marked, the message reads as "Expected statement"...googled to find navigation through recordset but could get only for access database, hence decided to get u'r help.

    Regards

    Arun

    <html>

    <title>

    Creating ADO dataset

    </title>

    <body>

    <%

    dim conn,rs,execstring

    set conn = server.createobject("ADODB.connection")

    set rs = server.createobject("ADODB.recordset")

    conn.open "provider = sqloledb,datasource = <myservername>,initial catalog = pubs,user id = user,password = password"

    execstring = "select * from pubs"

    set rs = conn.execute(execstring)

    do while not rs.eof

    <%Response.Write rs%> //error statement

    <%loop%>

    rs.close()

    conn.close()

    %>

    </body>

    </html>


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

  • Hi,

    You are trying to output the recordset object, what you need to do is output it's contents. Have a look at the rs.getstring method or you can loop the recordset

    do while not rs.eof

    'output some data e'g. response.write(rs(0))...

    rs.movenext

    loop

     

  • and u r right graham, i missed out the rs.movenext.  I have done that and it worked.

    Thanks again.

     


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply