hi i have a table name table1 i want to display all the records in the table by using data grid and when i try to run it there is no records display in the datagrid and i have already configure the datalink which i name it adodc. could anyone let me know where i get wrong? here is my code. i name my data grid as dbgrid
Dim rec_rs As New ADODB.Recordset Dim sql As String Dim con As ADODB.Connection Private Sub Form_Load() Set con = New ADODB.Connection con.Open "provider = microsoft.jet.oledb.4.0;persist security info = false; data source = " & App.Path & "\database1.mdb;" con.CursorLocation = adUseClient Set dbgrid.DataSource = Nothing sql = "select * from table1" rec_rs.Open sql, con, adOpenStatic, adLockOptimistic, adCmdText If rec_rs.EOF = False Then Set dbgrid.DataSource = rec_rs End If rec_rs.Close End Sub
i dont know how to use data grid hope i could you all can help me with this one..thanks.