Solved

SQL 6.5 & VB - No ODBC - How to set database?

Posted on 1998-07-22
8
593 Views
Last Modified: 2008-02-01
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!
0
Comment
Question by:BooH
8 Comments
 

Author Comment

by:BooH
ID: 1089163
Edited text of question
0
 

Expert Comment

by:orodriguez
ID: 1089164
send me your e-mail i will send you zip files samples  how to connect to an sql server
and retrieve data fromt using odbc an not using odbc


0
 

Author Comment

by:BooH
ID: 1089165
traci.hueskes@eds.com
0
 

Author Comment

by:BooH
ID: 1089166
And thank you so much!!!!
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Expert Comment

by:coggie
ID: 1089167
Hi BooH,

Set db = CurrentDB() ?

Coggie
0
 

Author Comment

by:BooH
ID: 1089168
I tried the 'set db = currentdb()', but it isn't a defined function.  Thanks, though!
0
 
LVL 3

Expert Comment

by:altena
ID: 1089169
truly amazing:
"using odbc an not using odbc"

Unless you have a VERY good excuse for trying to stunt like
this, please reconsider your design. For your own and your
customer's sake.
0
 

Accepted Solution

by:
kilobugs earned 100 total points
ID: 1089170
1st of all, we have to straight out something right here. You are using VBSQL library which is no longer supported in VB5. So be careful if you want to carry you code over to VB5. Okay, back to your question! I think you are pretty much mixed up the use of "OpenRecordset" with VBSQL library. Basically, "OpenRecordset" is for DAO and RDO. I think if you successfully establish a connection with your SQL Server, then you have to use "SQLCmd" pass the query from you application to your SQL Server. Then you have to use "SQLExec" to execute your SQL statement. And then, you have to use "SQLResults" to retrieve your resultsets!
Your question is pretty tricky ... ! Try looking up SQLCmd(SQLConn), SQLExec(SQLConn), and SQLResults(SQLConn) from your VB4 help! I think most of the people in here are either using DAO or RDO and that you have to set up a DSN connection or a DSN-less connection. Try DAO or RDO, I think it is a little bit better than VBSQL library.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now