Hi,
I know this may sound funny but, as a newbie in using VB (6months old), without proper teaching or learning guides,
I do call my db connection everytime I open a form.
If i have 5 forms, then i will open my connection 5 times or more than, and releases it when the opened form is closed..
How can i do opening my db connection on my Main form, then when i clck on the other form, the connection string that i opened on my Main Form is recognized and read.
Here's my code
Public Shared oCon As New OleDb.OleDbConnection
Public Shared oDs As New DataSet
Public Shared oDa As OleDb.OleDbDataAdapter
Public Shared oSQL, oTblName As String
Private Sub DBConn()
oCon.ConnectionString = "Provider=SQLOLEDB;UID=sa;PWD=citadbo;Initial Catalog=Citadeldbo;Data Source=ANALYST04NEW\SQLEXPRESS"
oCon.Open()
End Sub
DBConn() is then called at the Form's Load Event, Disposes when the form is released.
And to which i repeatedly copy and paste to my other forms.