Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Error in VB.net with MYSql

$
0
0
Hi all,

I do not have to much experience in VB.net. 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;"
sConnection.Open()
End If
Try
strSQL = "INSERT INTO Libros(Title,Desc) VALUES ('" & Title_text.Text & "', '" & Desc_text.Text & "')"
Dim da As New MySqlDataAdapter(strSQL, sConnection)
da.Fill(dset)
Catch ex As Exception
MessageBox.Show("Error")
End Try

Tittle_text.Text = ""
Desc_text.Text = ""
Class_combo.Text = ""
Date_text.Text = ""
Pres_text.Text = ""
Who_text.Text = ""
Title_text.Focus()
list()
End Sub
-----------------------

Any knows how to resolve this problem?
Thank you.


Viewing all articles
Browse latest Browse all 2703

Trending Articles