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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Public Class Consultation_stock
Dim Cmd As New OleDb.OleDbCommand, Da As New OleDb.OleDbDataAdapter, DT As New Data.DataTable
Private Sub Consultation_stock_Load(sender As Object, e As EventArgs) Handles MyBase.Load
OptCode.Checked = True
Call Connexion()
Call Remplir_Liste()
End Sub
Public Sub Remplir_Liste()
Dim Cmd As New OleDb.OleDbCommand, Da As New OleDb.OleDbDataAdapter, DT As New Data.DataTable
Dim req As String
DT.Clear()
DT.Columns.Clear()
If OptTous.Checked = True Then req = "SELECT Code,Article,Quantité_unitiale,Quantité_livrée,Stock_restant,observation,date_insertion FROM Stock"
If OptCode.Checked = True Then req = "Select Code,Article,Quantité_unitiale,Quantité_livrée,Stock_restant,observation,date_insertion From stock where code LIKE '" & TxtCodeR.Text & "%'"
If OptNom.Checked = True Then req = "Select Code,Article,Quantité_unitiale,Quantité_livrée,Stock_restant,observation,date_insertion From stock Where Article LIKE '" & UCase(TxtNomR.Text) & "%' "
Cmd.Connection = CN
If Cmd.Connection.State = ConnectionState.Closed Then Cmd.Connection.Open()
Cmd.CommandText = req
Da.SelectCommand = Cmd
Da.Fill(DT)
DataGridView1.DataSource = DT
DataGridView1.Columns(1).Width = 150
End Sub
Private Sub Consultation_stock_LocationChanged(sender As Object, e As EventArgs) Handles Me.LocationChanged
End Sub
Private Sub OptTous_CheckedChanged(sender As Object, e As EventArgs) Handles OptTous.CheckedChanged
End Sub
End Class |
Partager