Strange Error Updating, but doing fine
Posted by: satanorz
Date: February 05, 2007 02:35PM

Hello, i'm trying to code a class in vs 2k5 to make me easier the way of filling and updating datagridviews with mysql.

Here's the code.
Code:

Imports MySql.Data Imports MySql.Data.MySqlClient

Public Class MysqlGrid
Private cnn As MySqlConnection
Private da As MySqlDataAdapter
Private ds As New DataSet
Private cb As MySqlCommandBuilder

Sub New(ByVal grid As DataGridView, ByVal sTConexion As String, ByVal consulta As String)
cnn = New MySqlConnection(sTConexion)
da = New MySqlDataAdapter(consulta, cnn)
da.SelectCommand = New MySqlCommand(consulta, cnn)
cb = New MySqlCommandBuilder(da)
da.Fill(ds, "my_vb_net")
grid.DataSource = ds
grid.DataMember = "my_vb_net"
End Sub
Public Sub Update()
da.Update(ds.Tables("my_vb_net"))
End Sub
End Class



I'm creating the object on form load using ..

Code:

Dim grid as MysqlGrid grid = New MysqlGrid(DataGridView1, ConnectionString(), "select * from my_vb_net")



And updating ( or trying..) on button click using..

Code:

grid.update()

Ok, the datagridview is filling ok, and when i edit or add data on the grid and click on button to update.. it gives me this error..

"#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

The changes to the database has been made.. but an icon marking the line with error appears on datagrid.

Anyone have any idea about this? :S

Thanks for your time, and sorry about my poor english :P

Options: ReplyQuote


Subject
Written By
Posted
Strange Error Updating, but doing fine
February 05, 2007 02:35PM


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.