D
dave.rugh
I brought a project into Visual Studio 2005 that worked fine under VS
..NET 2003; now I'm getting an error when I execute a SP. With
profiler, I see the query going through fine; if I cut & paste and
execute it in an ISQL window, the query executes fine. The SP is
getting executed; but the error appears to be happening when the
command object is reading the results of the execution. There are no
results from the execution other than a count of the rows affected.
Here's the source snippet:
System.Data.SqlClient.SqlConnection sqlConn = new
System.Data.SqlClient.SqlConnection(dbConnect);
sqlConn.Open();
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = sqlConn;
sqlCmd.CommandText = "xxx_SPName";
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.Add(new SqlParameter("@ParamName",
strVar));
...(add other params)
sqlCmd.ExecuteNonQuery();
ex.GetBaseException():
{"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."}
[System.AccessViolationException]: {"Attempted to read or write
protected memory. This is often an indication that other memory is
corrupt."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Attempted to read or write protected memory. This is
often an indication that other memory is corrupt."
Source: "System.Data"
ex.StackTrace:
at SNIPacketGetConnection(SNI_Packet* )
at SNINativeMethodWrapper.SNIPacketGetConnection(IntPtr packet)
at System.Data.SqlClient.TdsParserStateObject.ProcessSniPacket(IntPtr
packet, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult
asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32
bytesExpected)
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
..NET 2003; now I'm getting an error when I execute a SP. With
profiler, I see the query going through fine; if I cut & paste and
execute it in an ISQL window, the query executes fine. The SP is
getting executed; but the error appears to be happening when the
command object is reading the results of the execution. There are no
results from the execution other than a count of the rows affected.
Here's the source snippet:
System.Data.SqlClient.SqlConnection sqlConn = new
System.Data.SqlClient.SqlConnection(dbConnect);
sqlConn.Open();
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = sqlConn;
sqlCmd.CommandText = "xxx_SPName";
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.Add(new SqlParameter("@ParamName",
strVar));
...(add other params)
sqlCmd.ExecuteNonQuery();
ex.GetBaseException():
{"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."}
[System.AccessViolationException]: {"Attempted to read or write
protected memory. This is often an indication that other memory is
corrupt."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Attempted to read or write protected memory. This is
often an indication that other memory is corrupt."
Source: "System.Data"
ex.StackTrace:
at SNIPacketGetConnection(SNI_Packet* )
at SNINativeMethodWrapper.SNIPacketGetConnection(IntPtr packet)
at System.Data.SqlClient.TdsParserStateObject.ProcessSniPacket(IntPtr
packet, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult
asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32
bytesExpected)
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result)
at
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()