how to insert null into sql database with ADO.Net C#

LawyerX

New Member
i have a DropDownList that display a collection of subset based on SetID from another ddl and some times it is null. how i can insert null value into database ?i tried with this code but not work:\[code\]CmdUpdate.Parameters.Add("@SubsetID",SqlDbType.Int);if (ddlSubset.Items.Count!=0){ CmdUpdate.Parameters["@SubsetID"].Value=http://stackoverflow.com/questions/15600535/ddlSubset.SelectedValue;}esle{ CmdUpdate.Parameters["@SubsetID"].Value=http://stackoverflow.com/questions/15600535/null;}\[/code\]
 
Back
Top