Insert from text box/query and show in labels.
Posted: Fri 05 Jun 2009 21:27
Hello,
I want to know how to insert values into a mysql data base from a text box, and how to read from the data base and show it in labels.
I'm developiing for windows mobile using vb2005, mysql and devart dot net connect for mobile.
The code i have to add data is the following:
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
If txt_ward.Text = "" Then
MsgBox("Please insert ward name.", MsgBoxStyle.Information, "Mobile Audit'09")
End If
Dim ward As String
ward = txt_ward.Text
MySqlConnection1.Open()
MySqlCommand1.ExecuteNonQuery()
Try
Catch exception As Devart.Data.MySql.MySqlException
MsgBox(exception.Message)
End Try
MySqlConnection1.close()
End Sub
The command text i have in the MySqlCommand1:
INSERT INTO audit (Auditor_id,Audit_date,Audit_Ward) VALUES (1,2009-06-04, txt_ward.text)
Any help ?
Thanks
I want to know how to insert values into a mysql data base from a text box, and how to read from the data base and show it in labels.
I'm developiing for windows mobile using vb2005, mysql and devart dot net connect for mobile.
The code i have to add data is the following:
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
If txt_ward.Text = "" Then
MsgBox("Please insert ward name.", MsgBoxStyle.Information, "Mobile Audit'09")
End If
Dim ward As String
ward = txt_ward.Text
MySqlConnection1.Open()
MySqlCommand1.ExecuteNonQuery()
Try
Catch exception As Devart.Data.MySql.MySqlException
MsgBox(exception.Message)
End Try
MySqlConnection1.close()
End Sub
The command text i have in the MySqlCommand1:
INSERT INTO audit (Auditor_id,Audit_date,Audit_Ward) VALUES (1,2009-06-04, txt_ward.text)
Any help ?
Thanks