Option Explicit Private Sub Command1_Click() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Set cnn = New ADODB.Connection cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB" cnn.Open Set rst = New ADODB.Recordset rst.CursorLocation = adUseClient rst.Open "SELECT OrderID, OrderDate FROM orders", cnn, adOpenStatic, adLockReadOnly Set DataGrid1.DataSource = rst DataGrid1.Refresh End Sub Private Sub Command2_Click() Dim intI As Integer Dim intJ As Integer With DataGrid1 'Go to top of the grid If Not (.DataSource Is Nothing) Then If .VisibleRows < .ApproxCount Then On Error Resume Next Do While True .Scroll 0, -100 .FirstRow = 0 If Err.Number <> 0 Then Exit Do Loop On Error GoTo 0 End If If .ApproxCount > 0 Then .Col = 0 .Row = 0 End If End If 'Get headers For intI = 0 To .Columns.Count - 1 MsgBox .Columns(intI).Caption Next intI 'Get all lines For intI = 0 To .ApproxCount - 1 For intJ = 0 To .Columns.Count - 1 MsgBox .Columns(intJ).Text Next intJ 'Incrémente la ligne (ne surtout pas enlever le "On error...") On Error Resume Next .Row = .Row + 1 On Error GoTo 0 Next intI End With End Sub