Error in with MYSql

Hi all,

I do not have to much experience in I am doing small application to practice.

In this case I am creating a VB application conneting to a MYSQL Database.

The problem I have is when I try to make a new register into the DDBB, I recieve a syntaxis error.

INSERT INTO Libros(Titulo,Desc) VALUES ('" & Titulo_text.Text & "', '" & Desc_text.Text & "')

However if I use the command into mysql server it works fine.

INSERT INTO Libros(Title,Desc) VALUES ()

Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click

If sConnection.State = ConnectionState.Closed Then
sConnection.ConnectionString = "SERVER = my server; USERID = joserodriguezan; PASSWORD = Aberystwyth; DATABASE = Bibloteca;"
End If
strSQL = "INSERT INTO Libros(Title,Desc) VALUES ('" & Title_text.Text & "', '" & Desc_text.Text & "')"
Dim da As New MySqlDataAdapter(strSQL, sConnection)
Catch ex As Exception
End Try

Tittle_text.Text = ""
Desc_text.Text = ""
Class_combo.Text = ""
Date_text.Text = ""
Pres_text.Text = ""
Who_text.Text = ""
End Sub

Any knows how to resolve this problem?
Thank you.


  • Hello,

    Please let me know the exact error message are you getting

    [URL=""]Bug Tracking[/URL] -
    [URL=""]Web Timesheet[/URL]
    [URL=""]Time Tracking Software[/URL]
  • Thank you Livetechs,

    I resolve the problem by myself.
    The problem was a syntaxis error in mysql command.

    I modified the sql commmand adding ` single quote in the command.
    strSQL = "INSERT INTO `Libros`(`Title`,`Desc`) VALUES ('" & Title_text.Text & "', '" & Desc_text.Text & "')"

    Thank you for you help.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!