我无法将我的时间组件保存DATETIME
到 SQL Server。
SQL Server 中的当前结果是,2012-08-24 00:00:00:000
但我想要 SQL Server 中的当前时间2012-08-24 14:25:50:789
private void Invoice_Load(object sender, EventArgs e)
{
txtTimeCurrent.Text = System.DateTime.Now.ToString();
}
private void btSave_Click(object sender, EventArgs e)
{
tbl_AsInvoice inv = new tbl_AsInvoice();
inv.AsInvMDate = Convert.ToDateTime(txtTimeCurrent.Text).Date;
using (TransactionScope ts = new TransactionScope())
{
db.tbl_AsInvoices.InsertOnSubmit(inv);
db.SubmitChanges();
ts.Complete();
}
}
我试试
inv.AsInvMDate = Convert.ToDateTime(txtTimeCurrent.Text);
它不工作。T_T