在数据库asp.net上将生日保存为日期类型

时间:2014-11-08 05:58:12

标签: c# asp.net datetime datepicker

您好我想在asp.net上使用日期选择器保存生日。在我的数据库数据类型是日期。我试过但数据没有保存。请建议

product.aspx

 protected void button_Click(object sender, EventArgs e)
    {
        if (new bizObj().AddBiz(new BizEnt(Convert.ToInt32(txtBizId.Text), Convert.ToInt32(txtUserId.Text), txtBizName.Text, txtBizAddress.Text, calcbizBorn.SelectedDate, Convert.ToInt32(txtBizBooks.Text))))
        {
            Response.Write("Successs"); 
            fillGird();
        }
        else
        {
            Response.Write("Error");
        }
    }




public Boolean AddBiz(BizEnt BizObj)
    {
        string qua = "exec addBiz'" + BizObj.Biz_Id + "','"
            + BizObj.User_Id + "','" + BizObj.Biz_Name + ","
              + BizObj.Biz_Address + "','" + BizObj.Biz_Born + "'"
                + BizObj.Bizr_Books + "'.'";

        return (new DataAccessLayer().executeNonQuaries(qua));
    }




public DateTime Biz_Born
    {
        get { return _BizBorn; }
        set { _BizBorn = value; }
    }

1 个答案:

答案 0 :(得分:0)

我认为您的qua字符串错误,请检查是否通过在sql上执行并更改

'" + BizObj.Biz_Born + "'

" + BizObj.Biz_Born + "