Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dataset has been lost
Message
From
03/01/2007 09:59:31
 
 
To
03/01/2007 03:07:03
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01181685
Message ID:
01181777
Views:
13
I don't see how the UPDATE has anything to do with it ... you're doing a DataAdapter.Fill() so it should be a SELECT that should be getting executed.

~~Bonnie


>In my data class, there is a method called SQLUpdate(). In it, the code is as follow:
>
>
>                oCommand.CommandText = cSQL
>
>                ' Only add the parameters if we have some
>                If oParameters2.Count > 0 Then
>                    For Each oDataParameter In oParameters2
>                        oCommand.Parameters.Add(oDataParameter)
>                    Next
>                End If
>
>                oDataAdapter.SelectCommand = oCommand
>                oDataSet = New DataSet
>                oDataAdapter.Fill(oDataSet)
>
>
>This is executed thousands of times per day. But, today, I got an:
>
>"Object reference not set to an instance of an object."
>
>message on the Fill() command. This is really weird. I cannot find why the oDataSet would be lost as it is just created the line before.
>
>The stack trace is as follow:
>
>
>at System.Data.ProviderBase.DbReferenceCollection.AddItem(Object value, Int32 tag)
>   at System.Data.OleDb.OleDbReferenceCollection.Add(Object value, Int32 tag)
>   at System.Data.ProviderBase.DbConnectionInternal.AddWeakReference(Object value, Int32 tag)
>   at System.Data.OleDb.OleDbConnection.AddWeakReference(Object value, Int32 tag)
>   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.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord,
>    Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
>   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable,
>    IDbCommand command, CommandBehavior behavior)
>   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
>   at Framework.Framework.Data.SQLUpdate(String tcSQL, Boolean tlUpdate)
>
>
>This was the update line:
>
>
>UPDATE MagaSche SET ModUser=0,ModDate={^2007/01/03 02:53:53},Hit=? WHERE Numero=?
>
>
>The parameters have been well set from the loDataProvider object from the data class:
>
>
>        loDataProvider.ParameterAdd("Hit", oRow("Hit") + 1)
>        loDataProvider.ParameterAdd("Numero", oRow("Numero"))
>        If Not loDataProvider.SQLUpdate("UPDATE MagaSche " + _
>         "SET Hit=" + loDataProvider.ParameterAddSQL("Hit") + " " + _
>         "WHERE Numero=" + loDataProvider.ParameterAddSQL("Numero")) Then
>            Return False
>        End If
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform