//Create an object
public object ConvertToDbReadyString(string value)
{
if (value == "0" || value == "")
return DBNull.Value;
else
return value;
}
//Pass value with sql parameter
SqlParameter[] pp = new SqlParameter[]
{
new SqlParameter("@SqlPara",ConvertToDbReadyString(tile)),// string
new SqlParameter("@SqlPara1",ConvertToDbReadyString(name)), //integer
new SqlParameter("@SqlPara2",ConvertToDbReadyString(age)),//integer
new SqlParameter("@SqlPara3",ConvertToDbReadyString(que)),//string
};
sqlCommon cmd;
cmd.ExecuteNonQuery(CN, CommandType.StoredProcedure, "insertdata", pp);
public object ConvertToDbReadyString(string value)
{
if (value == "0" || value == "")
return DBNull.Value;
else
return value;
}
//Pass value with sql parameter
SqlParameter[] pp = new SqlParameter[]
{
new SqlParameter("@SqlPara",ConvertToDbReadyString(tile)),// string
new SqlParameter("@SqlPara1",ConvertToDbReadyString(name)), //integer
new SqlParameter("@SqlPara2",ConvertToDbReadyString(age)),//integer
new SqlParameter("@SqlPara3",ConvertToDbReadyString(que)),//string
};
sqlCommon cmd;
cmd.ExecuteNonQuery(CN, CommandType.StoredProcedure, "insertdata", pp);
No comments:
Post a Comment