Stumped on MySQLDataAdapter Error

Stumped on MySQLDataAdapter Error

Postby jmurdock » Fri 20 Jan 2006 18:05

I am using the following code (incorrectly it appears)

I log all my errors to the EventLog and below the code is my error. The error does not make sense to me so...

Code: Select all
Function fnGetRemoteRestaurantData() As DataTable
    Dim dt As New DataTable
    Dim strCommandText As String
    Try
        strCommandText = "Select EstablishmentID, giftcert from Establishment order by EstablishmentID"
        Dim adapter As MySqlDataAdapter = New MySqlDataAdapter(strCommandText, Me.RemoteConn)
        adapter.Fill(dt)
        adapter.Dispose()
    Catch ex As Exception
        EventLog.WriteEntry(Me.ServiceName & ".fnGetRemoteRestaurantData()" & vbCrLf & vbCrLf & strCommandText & vbCrLf & vbCrLf & ex.ToString, EventLogEntryType.FailureAudit)
    End Try
    Return dt
End Function


Event Type: Failure Audit
Event Source: MagazineDataGrabber
Event Category: None
Event ID: 0
Date: 1/20/2006
Time: 11:24:24 AM
User: N/A
Computer: VNET-WEB
Description:
MagazineDataGrabber.fnGetRemoteRestaurantData()

Select EstablishmentID, giftcert from Establishment order by EstablishmentID

System.InvalidCastException: Specified cast is not valid.
at System.Convert.ToInt64(Object value)
at MySql.Data.MySqlClient.NativeDriver.Configure(MySqlConnection connection)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at MagazineDataGrabber.MagazineDataGrabber.fnGetRemoteRestaurantData()

****
Unfortunately I don't know the meaning of the error so I can't debug it. I have checked the data for Nulls and there are none. Neither field needs to be Int64, either could be Int32 with no issues.
jmurdock
 
Posts: 1
Joined: Fri 20 Jan 2006 17:59

Postby Serious » Mon 23 Jan 2006 09:13

Connector/NET is MySQL AB product, we do not support it. This is the forum of MySQLDirect .NET.

MySQLDirect .NET is data provider to direct access to MySQL database server for the Microsoft .NET Framework and .NET Compact Framework.
Key features of MySQLDirect .NET are listed here.
You can download free evaluation version here. Installation package includes required assemblies, full help system and various sample projects in C#, MC++, VB.NET, Delphi.
Serious
 


Return to dotConnect for MySQL