It appears I am getting an error with the FILL command at times. It
seems to be the LEN command in the stack that is the problem but this
is deep in the internal code of the Framework. I hope someone can
help me...
Here is my function I call to get data from the database and perform
all of my queries.
Public Function ExecuteQuery(ByVal strSQL As String, ByVal
myDataGrid As DataGrid, Optional ByVal Append As Boolean = False) As
Integer
Try
Dim myDataTable As New DataTable
Dim myAdaptor As New OdbcDataAdapter(strSQL,
m_objConnection)
Dim tempDataTable As DataTable
myAdaptor.Fill(myDataTable)
m_iFieldCount = myDataTable.Columns.Count
m_iRecordCount = myDataTable.Rows.Count
If Append And Not (myDataGrid.DataSource Is Nothing) Then
tempDataTable = myDataGrid.DataSource
For Each dr As DataRow In myDataTable.Rows
tempDataTable.Rows.Add(dr.ItemArray)
Next
Else
myDataGrid.DataSource = myDataTable
End If
Return (RecordCount)
Catch ex As Exception
Error_Show(ex, MsgBoxStyle.Exclamation)
Return (-1)
End Try
End Function
Below is the error stack I get when the FILL is performed...
DESCRIPTION:
len
STACK TRACE:
at System.Runtime.InteropServices.Marshal.PtrToStringUni(IntPtr
ptr, Int32 len)
at System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i)
at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap
typemap)
at System.Data.Odbc.OdbcDataReader.GetValue(Int32 i)
at System.Data.Odbc.OdbcDataReader.GetValues(Object[] values)
at System.Data.Common.SchemaMapping.LoadDataRow(Boolean
clearDataValues, Boolean acceptChanges)
at System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping
mapping)
at System.Data.Common.DbDataAdapter.FillFromReader(Object data,
String srcTable, IDataReader dataReader, Int32 startRecord, Int32
maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable,
IDataReader dataReader)
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 Expert_Services_Tools.clsConnection.ExecuteQuery(String strSQL,
DataTable myDataTable) in D:\My Documents\Visual Studio Projects
\Siebel Watcher\clsConnection.vb:line 324
SOURCE: PtrToStringUni"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment
You may subscribe to group Feeds using a RSS Feed Reader to stay upto date
using following url
<a href="http://feeds.feedburner.com/DotNetDevelopment">
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---