1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Dim MyNewRow As DataRow = dst.Tables("person").NewRow
Try
MyNewRow("First_Name") = Me.txtfirstname.Text
MyNewRow("Last_Name") = Me.txtlastname.Text
MyNewRow("Fone_Num") = Me.txtfonenum.Text
MyNewRow("Country") = Me.txtcountry.Text
dst.Tables("person").Rows.Add(MyNewRow)
Dim MyCommBuild As New MySqlCommandBuilder(da1)
da1.Update(dst, "person")
MsgBox("Nouvel enregistrement ajouté avec succé", MsgBoxStyle.Information)
Catch err As Exception
MsgBox(err.Message, MsgBoxStyle.Exclamation, "person")
dst = New DataSet
da1 = New MySqlDataAdapter("SELECT * FROM person", Host)
da1.Fill(dst, "person")
' ' DataGrid1.DataSource = dst.Tables("contact")
' 'MsgBox("OK")
Exit Sub
End Try |
Partager