Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: 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

  2. #2
    Join Date
    Nov 2003
    Posts
    76
    if it's in .net.
    then creating a class will be better.

  3. #3
    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?

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •