如何插入值,因为我的所有参数都为null?

时间:2017-07-31 05:28:50

标签: c#

db.AddInParameter(dbCommand, "@updateMode", DbType.String, entCommon.UpdateMode);
db.AddInParameter(dbCommand, "@requestNumber", DbType.String, entCommon.RequestNumber);
db.AddInParameter(dbCommand, "@description", DbType.String, entCommon.Description);
db.AddInParameter(dbCommand, "@RequestTypeID", DbType.String, entCommon.RequestTypeID);
db.AddInParameter(dbCommand, "@requestPriorityID", DbType.String, entCommon.RequestPriorityID);
db.AddInParameter(dbCommand, "@remarks", DbType.String, entCommon.Remarks);
db.AddInParameter(dbCommand, "@requestedBy", DbType.String, entCommon.RequestedBy);
db.AddInParameter(dbCommand, "@requestedDate", DbType.String, entCommon.RequestedDate);
db.AddInParameter(dbCommand, "@approvedBy", DbType.String, entCommon.ApprovedBy);
db.AddInParameter(dbCommand, "@approvedDate", DbType.String, entCommon.ApprovedDate);
dbCommand.CommandTimeout = 0;
DataSet dsData = null;
dsData = db.ExecuteDataSet(dbCommand);

1 个答案:

答案 0 :(得分:1)

问题不明确!

如果要为SQL参数设置空值 - 请使用

... = DBNull.Value;