How to Connect Datagrid control with Access database without using adodc


Visual Basic 6 :How to connect  DataGrid control with Access database without using ADODC (ADO data control) and display data in the datagrid control-Visual Basic 6.0 Tutorial -Step by Step


Code:
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Database Folder\Student Database.mdb;Persist Security Info=False"
rs.CursorLocation = adUseClient
rs.Open "Select * from Student_Info", con, adOpenKeyset, adLockPessimistic, adcmdtxt
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
Set rs = Nothing
End Sub

If you like my work ,Please hit LIKE button and Subscribe to my channel

0 comments:

 
google-site-verification: google18fa7bfb27754a8a.html google-site-verification: google089e704d9968b9b7.html