Anyone have any ideas?
System.NullReferenceException: Object reference not set to an instance of an
object.
System.NullReferenceException:
at System.Data.SqlServer.Internal.CClrXvarProxy.Close()
at System.Data.SqlServer.Internal.StreamOnBlobHandle.Discard()
at System.Data.SqlServer.Internal.XvarBlobStream.Discard()
at System.Data.SqlServer.Internal.SqlBinaryMaxBuffer.Dispose()
at System.Data.SqlServer.Internal.RequestExecutor.Dispose()
at System.Data.SqlServer.Internal.RequestExecutor.Close(SmiEventSink
sink)
at System.Data.SqlClient.SqlCommand.DisposeSmiRequest()
at
System.Data.SqlClient.SqlCommand.SetUpSmiRequest(SqlInternalConnectionSmi
innerConnection)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderSmi(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
"Geoff Chappell" <GeoffC...@discussions.microsoft.com> wrote in message
news:D386EA15-D5A5-4072...@microsoft.com...
I figured the stack trace was the most relevant info since the null ref is
occurring within msft code. I doubt there's anything I'm doing directly that
is causing it, but am hoping there's some indirect way to control it.
The code is straight forward -- here's the shape of it (though not exact
code):
SqlCommand cmd = new SqlCommand();
cmd.CommandText = @"insert into ...; select ..."
cmd.Parameters.Add(new SqlParameter("@val", SqlDbType.VarBinary, -1))
cmd.Connection = conn; //open context connection that was passed in
cmd.Parameters[0].Value = ...; //param as byte[]
SqlDataReader rdr = cmd.ExecuteReader();
The select query returns a varbinary(8). I've verified through debug dumps
that the params are valid and the same param will work fine through the same
methid in most other cases.