My codes here is applicable in VB6.0, this is what I used to connect and do some query.
this is in the module.
Public DBCon As ADODB.Connection Public Concom As ADODB.Command Public DBrs As ADODB.Recordset Public Sub DBConnect() Set DBCon = New ADODB.Connection Set Concom = New ADODB.Command Set DBrs = New ADODB.Recordset DBCon.ConnectionString = "Provider=Microsoft.jet.oledb.4.0; Data Source=" & App.Path & "\Database\HRIS.mdb" DBCon.Open Concom.ActiveConnection = DBCon End Sub Public Sub SQLcmd(SQLstatement As String) Concom.CommandText = SQLstatement Set DBrs = Concom.Execute End Sub
after that I just call the dbconnect to every form, then use the sqlcmd for the query like this.
SQLcmd "select * from tblePerson where Fname = " & txtSearch & ""
I tried to do this in vb2010 but it just won't work. I search over google about adodb in vb.net but i got confused. Sorry, I just don't know where to start and what to do. Any help would greatly be appreciated. Thank you.