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