dineshchirayil
October 7th, 2005, 09:49 AM
hi
I am doing one project which has ten or more forms and using access as database .I want to know about connect connection which is used in forms for insert and updating .now I am using OLEDBConnection. We wrote a Module for that. Like this
Imports ODS = System.Data.OleDb
Public con As New ODS.OleDbConnection()
Public Com As New ODS.OleDbCommand()
Sub ConnecttoDatabase()
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\data.mdb"
Com.Connection = con
Try
con.Open()
'MsgBox("Successfully Connected.", MsgBoxStyle.Information, "Success")
Catch ex As Exception
MsgBox("This Error was occurred While Trying to Connect to Database. " & ex.Message)
End
End Try
End Sub
I open connection at startup and close when application ends.
I want know whether it is the Proper way or not
Some one told me that every insertion of data we have to open and after close the connection. I want to know which is the PROPER WAY to do this. And what is connection pooling ? Help me .....
I am doing one project which has ten or more forms and using access as database .I want to know about connect connection which is used in forms for insert and updating .now I am using OLEDBConnection. We wrote a Module for that. Like this
Imports ODS = System.Data.OleDb
Public con As New ODS.OleDbConnection()
Public Com As New ODS.OleDbCommand()
Sub ConnecttoDatabase()
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\data.mdb"
Com.Connection = con
Try
con.Open()
'MsgBox("Successfully Connected.", MsgBoxStyle.Information, "Success")
Catch ex As Exception
MsgBox("This Error was occurred While Trying to Connect to Database. " & ex.Message)
End
End Try
End Sub
I open connection at startup and close when application ends.
I want know whether it is the Proper way or not
Some one told me that every insertion of data we have to open and after close the connection. I want to know which is the PROPER WAY to do this. And what is connection pooling ? Help me .....