purplehaze1
Programmer
How can I share ado.net connection across multiple processes?
eg. I have two classes, clsimport and clsexport. I want to open a connection and execute processes in both classes using the same open connection object. Following is my procedure to open connection from yet another class module clsLogin.
Similarly, I want to share ConnectionString across all class modules.
How to do it? Any technical example will be very helpful. Thanks.
Function Connect() As Boolean
Try
ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info = False;" & _
"Initial Catalog = " & database & ";Data Source = " & Server & ";User ID =" & userName & ";Password =" & password & ";"
myConnection = New OleDbConnection(ConnectionString)
myConnection.Open()
myConnectFlag = True
Return True
Catch e As Exception
Console.WriteLine(e.ToString())
End Try
End Function
eg. I have two classes, clsimport and clsexport. I want to open a connection and execute processes in both classes using the same open connection object. Following is my procedure to open connection from yet another class module clsLogin.
Similarly, I want to share ConnectionString across all class modules.
How to do it? Any technical example will be very helpful. Thanks.
Function Connect() As Boolean
Try
ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info = False;" & _
"Initial Catalog = " & database & ";Data Source = " & Server & ";User ID =" & userName & ";Password =" & password & ";"
myConnection = New OleDbConnection(ConnectionString)
myConnection.Open()
myConnectFlag = True
Return True
Catch e As Exception
Console.WriteLine(e.ToString())
End Try
End Function