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
This is my code but it does nothig:
Dim myConnectionString As String
myConnectionString = "server=;" _
& "uid=root;" _
& "pwd=greed;" _
& "database=registru;"

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
Case 0
MessageBox.Show("Cannot connect to server. Contact administrator")
Case 1045
MessageBox.Show("Invalid username/password, please try again")
End Select
End Try

please help me :).

Options: ReplyQuote

Written By
Insert into table
August 13, 2009 02:18AM
September 06, 2009 10:13AM

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.