List:MySQL and .NET« Previous MessageNext Message »
From:Carlos Cruz Date:July 9 2008 9:39pm
Subject:Error using 5.1.6.0 version using the same code for 5.1.5.0
View as plain text  
Hi,

I started working with the .NET Connector 5.1.5.0 a few months and decided
to migrate to 5.1.6.0 today. I made this decision in order to see if some
errors I've experienced would be solved.
I've just added the new DLL reference to my project and tryed it, but every
time I do the *adapter.update(datatable)* I receive an error that I don't
understand why!
The same kind o error that occurs when we forgot ne "NEW" keyword. I've
checked both, the adapter and the datatable, and I found data in the
datatable and some properties set in the adapter.
(So I'm returning to the older version for now)

I'm using the connector this way:

Main Class

Private da As MySqlDataAdapter
Private cb As MySqlCommandBuilder
Private dt As Datatable

Public Function GetData() as Datatable
        da = New MySqlDataAdapter(sSQL, sConn)
        dt = New DataTable
        cb = New MySqlCommandBuilder(da)
        Try
            da.Fill(dt)
        Catch ex As MySqlException
            Return Nothing
        End Try
        Return dt
End Function

Public Function InsertData(str1, str2) as Boolean
        Dim dr As DataRow = dt.NewRow
        dr(0) = str1
        dr(1) = str2
        dt.Rows.Add(dr)
        try
            da.update.(dt)
        catch ex As MySqlException
            Return False
        End Try

        Return True
End Function

End Main Class

I just call the methods GetData(), and InsertData() (after the input).

I've 3 questions:
1) Usually I don't use connection.open and connection.close when using
adapter.update, because ADO.NET do this for me in this simple cases. Does
anyone knows if this can be the problem?
2) What changed on this new version that can be generating this error,
knowing that I'm using exactly the same code with 5.1.5.0 without any
problems (doing this operation)?
3) What do I need to change in my code?

Thanks in advance,
CC

Thread
Error using 5.1.6.0 version using the same code for 5.1.5.0Carlos Cruz9 Jul