2014-11-08 41 views
0

嗨,我想在asp.net上使用日期選擇器保存borthday。在我的db數據類型是Date。我試過但數據不能保存。請指教在數據庫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; } 
    } 
+0

是有顯示任何錯誤? – 2014-11-08 06:00:46

+0

@AnikIslamAbhi:不會迴避錯誤,但它會導致Else循環並顯示「錯誤」消息 – shumz 2014-11-08 06:03:40

+0

您可以在此處發佈錯誤消息嗎? – 2014-11-08 06:05:18

回答

0

我覺得你的QUA字符串是錯誤的支票,通過SQL執行和改變

'" + BizObj.Biz_Born + "' 

" + BizObj.Biz_Born + " 
+0

感謝它的工作 – shumz 2014-11-08 07:01:18

相關問題