Update table from datagrid

Hi,

I have a datagrid which fills properly from my datasource.  However, I am unable to save any changes.  When I hit the save button I get:  "ERROR [23000] [MySQL][ODBC 3.51 Driver][mysqld-5.0.15-nt]You have an error in your SQL syntax "   I have spent hours on this so any help is appreciated.

Thanks


Imports System.Data.odbc

Public Class frmAdminLists
 
    Private cb As OdbcCommandBuilder

    Private Sub frmAdminLists_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub lblDelInst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblDelInst.Click
        cb = New OdbcCommandBuilder(daDelInst)
        daDelInst.Fill(dsDelInst, "Fontana_DelInst")
        dgDelInst.DataSource = dsDelInst.Tables("Fontana_DelInst")
    End Sub
         
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

        Dim ds_New As DataSet = dsDelInst.GetChanges()

        daDelInst.Update(ds_New, "Fontana_DelInst")   <<<<<<<ERROR IS HERE>>>>>>>

    End Sub

End Class
LVL 5
maralansAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amyhxuCommented:
How about this:

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

        daDelInst.Update(dsDelInst, "Fontana_DelInst")

    End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maralansAuthor Commented:
amyhxu,

I used your code so the points are yours.  The real problem was I changed my select statement to  - Private scDelInst As String = "SELECT Instruct AS 'Delivery Instructions' from Fontana_Instructions ORDER by Instruct" to change the header on the datagrid without realizing, at the time, it changed the field name.  When I removed the AS part it works fine.  The good news is, I am too new at this to feel stupid. Thanks again for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.