Hey all!
I thought I read somewhere that it is best to use a function that returns a connection object whenever a connection object is used thereby keeping the connections centralized.
I cannot recall what I have to do to accomplish this, I have tried something simple, but find that I cannot reuse the connection.
The function looks a little like this:
Public function GetNewConnection()as connection
if conn is nothing then
set conn=new connection
conn.open (blah blah blah)
end if
set GetNewConnection=conn
end function
When I use it:
Private sub Save()
set thisConn=new Connection
set thisConn=GetNewConnection
rs.open (whatever)
end sub
This method is called from another form. The first time it is called, no problems. The second time though, the connection object's state is 0. Closed.
Can someone please tell me what I am doing wrong?
Thanks in advance
Dave
I thought I read somewhere that it is best to use a function that returns a connection object whenever a connection object is used thereby keeping the connections centralized.
I cannot recall what I have to do to accomplish this, I have tried something simple, but find that I cannot reuse the connection.
The function looks a little like this:
Public function GetNewConnection()as connection
if conn is nothing then
set conn=new connection
conn.open (blah blah blah)
end if
set GetNewConnection=conn
end function
When I use it:
Private sub Save()
set thisConn=new Connection
set thisConn=GetNewConnection
rs.open (whatever)
end sub
This method is called from another form. The first time it is called, no problems. The second time though, the connection object's state is 0. Closed.
Can someone please tell me what I am doing wrong?
Thanks in advance
Dave