Insert into table
Posted by: Amalia Stan
Date: August 13, 2009 02:18AM
A have a problem in trying to insert data in mysql table from vb.net.
This is my code but it does nothig:
Dim myConnectionString As String
myConnectionString = "server=192.168.0.51;" _
& "uid=root;" _
& "pwd=greed;" _
Dim conn As New MySql.Data.MySqlClient.MySqlConnection(myConnectionString)
MessageBox.Show("Connection Opened Successfully")
Dim sql As String
sql = "INSERT INTO registru_i_o (Nr_inregistrare,Data_Intrare,Unitatea_emitenta,Continut,Responsabil,Data_iesire,Unitatea_rec) VALUES(" + TextBox1.Text + "," + DateTimePicker1.Value + "," + TextBox2.Text + "," + TextBox3.Text + "," + TextBox4.Text + "," + DateTimePicker2.Value + "," + TextBox5.Text + ")"
Dim adapter As New MySqlDataAdapter
adapter.InsertCommand = New MySqlCommand(sql, conn)
Catch ex As MySql.Data.MySqlClient.MySqlException
Select Case ex.Number
MessageBox.Show("Cannot connect to server. Contact administrator")
MessageBox.Show("Invalid username/password, please try again")
please help me :).
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.