If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > declaring global connections in databases

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-10-04, 01:06
diptiman diptiman is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
declaring global connections in databases

how to declare a global connection in database that will be called in all other form modules rather than explicitly defining the connection everytime when separate form module is loaded.

ANSWER FAST PLS!

Diptiman Basak
Reply With Quote
  #2 (permalink)  
Old 02-10-04, 09:46
sivaroo sivaroo is offline
Registered User
 
Join Date: Nov 2003
Posts: 76
if it's in .net.
then creating a class will be better.
Reply With Quote
  #3 (permalink)  
Old 02-10-04, 13:20
diptiman diptiman is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
VB Database connectivity

I know in .NET its possible. but won't it be possible in VB 6.0?
Reply With Quote
  #4 (permalink)  
Old 02-10-04, 13:50
sivaroo sivaroo is offline
Registered User
 
Join Date: Nov 2003
Posts: 76
in vb 6

Declare in a module and you can call it anywhere in your program

Public conn1 as adodb.connection

create
public function openconn()
on error goto errConn
strConn= your connection string
set conn1=new adodb.connection
conn1.connectionstring=strConn
conn1.open

exit function
errConn:
end function

this can be called anywhere
if conn1.state=adstateopen then
conn1.execute(your SQL to execute)
end if

HTH
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On