V
VB Programmer
I am getting a "IErrorInfo.GetDescription failed with E_FAIL" error when
trying to do a "Fill" on a dataadapter. Any ideas?? The SQL command seems
good (to an Access db).
Here is the general function that I am using in a lot of other places
successfully. This is the one that fails on "da.Fill(dt)"...
Public Function GetDataTable(ByVal strSql As String, ByVal strCnnString
As String) As DataTable
Dim cnn As New OleDbConnection(strCnnString)
Try
cnn.Open()
Dim dt As New DataTable
Dim cmd As New OleDbCommand(strSql, cnn)
Dim da As New OleDbDataAdapter(cmd)
da.Fill(dt) ' ***** THIS IS WHERE THE ERROR OCCURS
Return dt
Catch ex As Exception
HandleError(ex)
Finally
If cnn.State = ConnectionState.Open Then
cnn.Close()
End If
End Try
End Function
This is the full error:
"System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
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 TropicalIslandCitrus.SqlHelper.GetDataTable(String strSql, String
strCnnString) in
c:\inetpub\wwwroot\TropicalIslandCitrus\Components\SQLHelper.vb:line 27"
Any help would be appreciated. Thanks!
trying to do a "Fill" on a dataadapter. Any ideas?? The SQL command seems
good (to an Access db).
Here is the general function that I am using in a lot of other places
successfully. This is the one that fails on "da.Fill(dt)"...
Public Function GetDataTable(ByVal strSql As String, ByVal strCnnString
As String) As DataTable
Dim cnn As New OleDbConnection(strCnnString)
Try
cnn.Open()
Dim dt As New DataTable
Dim cmd As New OleDbCommand(strSql, cnn)
Dim da As New OleDbDataAdapter(cmd)
da.Fill(dt) ' ***** THIS IS WHERE THE ERROR OCCURS
Return dt
Catch ex As Exception
HandleError(ex)
Finally
If cnn.State = ConnectionState.Open Then
cnn.Close()
End If
End Try
End Function
This is the full error:
"System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with
E_FAIL(0x80004005).
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
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 TropicalIslandCitrus.SqlHelper.GetDataTable(String strSql, String
strCnnString) in
c:\inetpub\wwwroot\TropicalIslandCitrus\Components\SQLHelper.vb:line 27"
Any help would be appreciated. Thanks!