|
-
February 23rd, 2000, 05:02 PM
#1
Opening and closing an ADO Connection
My project consists of several forms and it is becoming that I seem to open a new dbConnection in each forms load event. I have read several things on how to do a global connection and how to do it. But when I tried to declare a Global connection, I couldn't compile past the db.Open line. The code below is what I am using in each of my forms currently:
Dim db as Connection
set db = new Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=MyFileServer;uid=sa;pwd=;database=junk;"
I am using VB6 SP3 and SQL Server 6.5. What could I possibly be doing wrong? Also, do I need to close each connection on each form unload or does it close by itself when another form opens a new connection?
I am also trying to open a connection and execute a SQL statement. The SQL Statement is "UPDATE table SET blah WHERE blah". What do I do after I build my statement? rs.Open? rs.Update? Where can I find some good info on these procedures.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|