Microsoft
Software
Hardware
Network
Question : how to insert null value in a table using SQLParameter class
i am working on a windows application made in C# dotnet 2005.
in this i have a form which have a list which gets filled from another table.
basically i have a column in a table which is forgein key.
now i wrote a update query and i want to insert null if user does not select any item from the list.
and this column is of int type in the database.
and i am using SQLParameter class to add values in update query.
here is a sample code of how i am using SQLParameter class
SqlParameter SqlParam_GeneralLedgerAcco
untOID = new SqlParameter();
SqlParam_GeneralLedgerAcco
untOID.Par
ameterName
= "@OID";
SqlParam_GeneralLedgerAcco
untOID.Val
ue = OID;
command.Parameters.Add(Sql
Param_Gene
ralLedgerA
ccountOID)
;
how can insert null value using SQLparameter class
Answer : how to insert null value in a table using SQLParameter class
Hello deepakyadav,
Assuming that your column allows NULL values then it would be:
SqlParam_GeneralLedgerAcco
untOID.Val
ue = DBNull.Value;
Regards,
TimCottee
Random Solutions
Outlook voting button no response summary
Combo Box Events
Parallels Workstation
stop error 0x000000d1 (0x00000000, 0x00000002, 0x00000000, 0x00000000) DRIVER_IRQL_NOT_LESS_OR_EQ<wbr />UAL
invalid case exception occurred, specified cast not valid.
flickering in dialog controls
Would like to add column to existing Datatable, then add items to it one at a time.
Reporting Services Configuration Error
SBS 2008 DNS
Trying to reconnect a deleted exchange mailbox into an existing user account