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 43 44 45 46 47 48 49 50 51 52 53 54
|
Protected Sub Button1_Click( ByVal sender As Object , ByVal e As System.EventArgs)
Dim con As System.Data.OleDb.OleDbConnection
Dim command As System.Data.OleDb.OleDbCommand
Dim req As String
Dim ligneconnection As String
con =
New System.Data.OleDb.OleDbConnection()
ligneconnection =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DBase\liens.accdb;Persist Security Info=False;"
con.ConnectionString = ligneconnection
con.Open()
req =
"INSERT INTO Client(CodeClient, NomClient, Contrat, AccordTeleInterv, Ticket, Email)"
req &=
"VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & DropDownList1.SelectedItem.Value & "','" & CheckBox1.Checked & "','" & TextBox3.Text & "','" & TextBox4.Text & "');"
command =
New System.Data.OleDb.OleDbCommand(req,con)
command.ExecuteNonQuery()
Label1.Text =
"Le client " & TextBox2.Text & " a bien été ajouté"
Label1.Visible =
True
con.Close()
End Sub |
Partager