Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 1998-07-22
8
Medium Priority
?
610 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:BooH
ID: 1089166
And thank you so much!!!!
0
 

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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

604 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