[Mono-dev] Error passing DBNull to SQLClient AddParameter method
APS
subscription.sapi at apsystems.it
Thu May 25 08:40:16 EDT 2006
I'm trying to update a record in SQLServer using
System.Data.SqlClient.SqlCommand:ExecuteNonQuery() method.
Adding parameters to the command I use
IDbDataParameter param=CreateParameter();
param.ParameterName=parameterName;
param.Value=DBNull.Value;
Running the query I obtain the error below
System.Data.SqlClient.SqlException: Disallowed implicit conversion
from data type sql_variant to data type varchar, table 'tablename',
column 'columnname'. Use the CONVERT function to run this query.
in <0x000a0> System.Data.SqlClient.SqlConnection:ErrorHandler
(System.Object sender,
Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
in (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object_TdsInternalErrorMessageEventArgs
(object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in <0x0001d> Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage
(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
in <0x001bf> Mono.Data.Tds.Protocol.Tds:ProcessMessage
(TdsPacketSubType subType)
in <0x0012c> Mono.Data.Tds.Protocol.Tds:ProcessSubPacket ()
in <0x00090> Mono.Data.Tds.Protocol.Tds:NextResult ()
in (wrapper remoting-invoke-with-check)
Mono.Data.Tds.Protocol.Tds:NextResult ()
in <0x00010> Mono.Data.Tds.Protocol.Tds:SkipToEnd ()
in (wrapper remoting-invoke-with-check) Mono.Data.Tds.Protocol.Tds:SkipToEnd ()
in <0x00074> Mono.Data.Tds.Protocol.Tds:ExecuteQuery (System.String
sql, Int32 timeout, Boolean wantResults)
in <0x0006e> Mono.Data.Tds.Protocol.Tds70:Execute (System.String
commandText, Mono.Data.Tds.TdsMetaParameterCollection parameters,
Int32 timeout, Boolean wantResults)
in <0x002eb> System.Data.SqlClient.SqlCommand:Execute
(CommandBehavior behavior, Boolean wantResults)
in <0x00048> System.Data.SqlClient.SqlCommand:ExecuteNonQuery ()
The same thing i .NET works correctly, I'm doing something's wrong?.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060525/3f40e31d/attachment.html
More information about the Mono-devel-list
mailing list