how to send a null parameter to a Store Procedure with ADO.net

  • Thread starter Thread starter Tony qu
  • Start date Start date
T

Tony qu

I wrote a Store Procedure which can deal with null parameter. But when I try
to use it in Ado.net, I found that I can't AddParameter with a null value,
what should I do? Thank you for your help in advanced
 
Hi,

you can do it like this: -

mycmd.Parameters.Add("@id", System.Data.SqlDbType.text);
mycmd.Parameters["@id"].Value = System.DBNull.Value;

Regards
Joyjit
 
Back
Top