0% found this document useful (0 votes)
6 views1 page

Sub Remplircmbclient

This document contains code for a form application that allows adding, modifying, and deleting records in a database table. The form contains combo boxes and text boxes to select and enter data, and buttons to perform database operations when clicked.

Uploaded by

banouniyassine1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Sub Remplircmbclient

This document contains code for a form application that allows adding, modifying, and deleting records in a database table. The form contains combo boxes and text boxes to select and enter data, and buttons to perform database operations when clicked.

Uploaded by

banouniyassine1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1 Dim query As String = "INSERT INTO commande (Id_Cli,

ID_Prod, Qte) VALUES (" & CInt(ComboBox1.SelectedValue) & ", " &
Dim con As New MySqlConnection CInt(ComboBox3.SelectedValue) & ", " & CInt(TextBox1.Text) & ")"

Sub seconnecter() Dim command As New MySqlCommand(query, con)

con = New MySqlConnection("server=localhost ; If command.ExecuteNonQuery() Then


database=commande;Uid=root")
MessageBox.Show("Bien Ajouté")
con.Open()
remplirCmbGrid()
End Sub
End If
Sub remplirCmbClient()
End Sub
Dim cmd = New MySqlCommand("select * from client", con)
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Dim dr = cmd.ExecuteReader Button3.Click

Dim t As New DataTable Modifier :

t.Load(dr) Dim query As String = "update commande set Qte=" &


CInt(TextBox1.Text) & " where `Id_Cli`=" &
ComboBox1.ValueMember = "Id_cl" CInt(ComboBox1.SelectedValue) & " AND `ID_Prod` =" &
CInt(ComboBox3.SelectedValue)
ComboBox1.DisplayMember = "nom"
Dim command As New MySqlCommand(query, con)
ComboBox1.DataSource = t
If command.ExecuteNonQuery() Then
End Sub
MessageBox.Show("Bien Modifié")
Sub remplirCmbProduit()
remplirCmbGrid()
Dim cmd = New MySqlCommand("select * from Produit", con)
End If
Dim dr = cmd.ExecuteReader
End Sub
Dim t As New DataTable
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
t.Load(dr) Button2.Click

ComboBox3.ValueMember = "id_produit" Supprimer :

ComboBox3.DisplayMember = "libele" Dim query As String = "delete From commande where `Id_Cli`=" &
CInt(ComboBox1.SelectedValue) & " AND `ID_Prod` =" &
ComboBox3.DataSource = t CInt(ComboBox3.SelectedValue)

End Sub Dim command As New MySqlCommand(query, con)

Sub remplirCmbGrid() If command.ExecuteNonQuery() Then

Dim cmd = New MySqlCommand("select client.nom, produit.libele MessageBox.Show("Bien supprimer")


,produit.prix,commande.Qte from client,produit,commande where
client.Id_client=commande.Id_Client and remplirCmbGrid()
produit.id_Produit=commande.ID_Produit;", con)
End If
Dim dr = cmd.ExecuteReader
End Sub
Dim t As New DataTable
Private Sub BackgroundWorker1_DoWork(sender As Object, e As
t.Load(dr) System.ComponentModel.DoWorkEventArgs) Handles
BackgroundWorker1.DoWork
DataGridView1.DataSource = t
End Sub
End Sub
End Class
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load

seconnecter()

remplirCmbClient()

remplirCmbProduit()

remplirCmbGrid()

End Sub

Ajouter

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click

You might also like