public bool insertRowIntoApplicant(int AnsId, string Name)
{
string CS = Utilities.GetConnString();
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("Insert Into ApplicantTable (AnswerableId, Name) values (@AnsId, @Name);
SqlParameter paraAnsId = new SqlParameter()
{
ParameterName ="@AnsId",
SqlDbType = System.Data.SqlDbType.Int,
Direction = System.Data.ParameterDirection.Input,
Value = AnsId
};
cmd.Parameters.Add(paraAnsId);
cmd.Parameters.Add(paraName);
}
}
我从隐藏字段中获取值
int getAnswerabelValue = Convert.ToInt32(hfAnswerableID.Value);
if (dal_Obj1.insertRowIntoApplicant(getAnswerabelValue, Name)
{
}
我的问题是getAnswerabelValue有时可以为空,那么如何更改我的代码?
白板的微信
相关分类