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 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.