<asp:TextBox ID="txtBox" runat="server">
</asp:TextBox>
<asp:CalendarExtender ID="ce" runat="server" TargetControlID="txtBox" Format="dd-MMM-yyyy">
</asp:CalendarExtender>
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection239"].ToString()))
{
SqlCommand cmd = new SqlCommand("insert into tbl_testing(dttm) values('"+DateTime.Parse(txtBox.Text)+"')", con);
con.Open();
cmd.ExecuteNonQuery();
}
當我執行以下錯誤即將到來。我應該使用哪種格式將日期發送到sql服務器日期時間轉換錯誤asp.net與sql server
將char數據類型轉換爲日期時間數據類型導致超出範圍的日期時間值。 該聲明已被終止。 在此先感謝您的查詢
給我們一些工作日期和日期的例子... – nik0lias 2010-12-13 09:41:11