1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Try
Dim con As New SqlConnection("Server = . ; DataBase = GestionCommande; integrated security = true")
Dim req As String
req = "Select * from client where cli_nom like '" & Me.txtFiltre.Text & "%'"
Dim Cmd As New SqlCommand(req, con)
con.Open()
Dim Dr As SqlDataReader
Dr = Cmd.ExecuteReader
Dim i As Integer
i = 0
If Dr.Read = True Then
Me.DataGridView1.Rows.Add()
Me.DataGridView1.Item(0, i).Value = Dr(0)
Me.DataGridView1.Item(1, i).Value = Dr(1)
Me.DataGridView1.Item(2, i).Value = Dr(2)
Me.DataGridView1.Item(3, i).Value = Dr(3)
Me.DataGridView1.Item(4, i).Value = Dr(4)
i = i + 1
Else
(Je ne sais pas quoi faire là :S)
End If
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try |
Partager