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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC-less connections with SQL server

Status
Not open for further replies.

LucyP

Programmer
Jan 17, 2001
51
ES
Why is it that when I try to connect to SQL server (ASP using VBScript) without using ODBC - i.e. specifying the driver and server in the connection string - I cannot make a recordset. The error message tells me that the connection object is closed. Do all of the books have typos in the sections where they tell you how to do this????
 
you should try something like this:
ostr = "driver={SQL Server};server=[servername];database=[databasename]"
set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
sql = "SELECT * FROM [tablename]"
cn.open ostr
rs.open sql, cn, 3, 3

this way you ope you recordset for read, write, update and delete.

Goodluck..



(ps: change the stuff between [])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top