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
| Public Sub save_names(ByRef SQLstatement As String)
Dim cmd As MySqlCommand = New MySqlCommand
With cmd
.CommandText = SQLstatement
.CommandType = CommandType.Text
.Connection = SQLconnection
.ExecuteNonQuery()
End With
SQLconnection.Close()
MsgBox("ajouté")
SQLconnection.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SQLStatement As String = "INSERT INTO `arikabase`.`visiteur` (`visiteurID`, `Nom`, `Prenom`, `Tel`, `Adresse Mail`, `Adresse`) VALUES (NULL, '" & TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "', '" & TextBox5.Text & "');"
save_names(SQLStatement)
End Sub
Private Sub VisiteurBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VisiteurBindingNavigatorSaveItem.Click
Me.Validate()
Me.VisiteurBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.ArikabaseDataSet)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cmd As MySqlCommand = New MySqlCommand
Dim SQLStatement As String = "SELECT Nom FROM `arikabase`.`visiteur`WHERE VisiteurID=2;"
Dim da As New MySqlDataAdapter
da.SelectCommand = cmd
Dim d As New BindingSource
Dim ds As New DataSet |
Partager