SQL 6.5 & VB - No ODBC - How to set database?
Posted on 1998-07-22
I'm creating a VB 4.0 application to access data on an SQL server 6.5 database. I'm not using ODBC, but an .ini file instead. My last stumbling block (I hope!) is how to set the database parameter so that I can create a recordset with the results of my query.
Below is what PREVIOUSLY set the database for me (when the data was on Sybase, and we used ODBC):
connect_string = "ODBC;DSN=APPLE;DATABASE=SEED1;"
Set db = OpenDatabase("APPLE", False, False, connect_string)
The following code is what NOW sets the connection to the database, but it doesn't set the actual database object:
SqlConn& = SqlOpenConnection(ServerName$, User$, Pwd$, "", "")
I know I'm connecting to the server and database successfully, but just can't seem to set the database parameter. This is killing me because when I go to run the query against the database, I can't create the recordset without the database object as a reference (see below):
Set gSrchSet = db.OpenRecordset(gSrchStr, dbReadOnly)
It doesn't know what 'db' is.
Please help me! I've been going crazy on this for weeks! Huge appreciation to anyone who can help! Thanks so much!