Last post Aug 29, 2012 09:31 PM by Decker Dong - MSFT
Aug 28, 2012 01:37 AM|mootoon|LINK
I don't save datetime to sqlServer
Result Current in sqlServer 2012-08-24 00:00:00:000
But I want result Time Current in Sqlserver 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);
using (TransactionScope ts = new TransactionScope())
Thank for help me :).
Aug 28, 2012 01:43 AM|Bryan Strader|LINK
Aug 28, 2012 03:26 AM|mootoon|LINK
It's don't working T_T
Aug 28, 2012 05:03 PM|jitheshb|LINK
Instead of sending current datetime throught a text and converting it to date, can't u pass the Datetime directly to save click event
inv.AsInvMDate = DateTime.Now.
Or try using
Aug 29, 2012 09:31 PM|Decker Dong - MSFT|LINK
don't save datetime to sqlServer
If you don't save datetime manually into datatable，it will be rendered as a default one——with hours，minutes and seconds set to default values of 0.
So please assign the value manually by using new DateTime(year,month,day,hours,minutes,seconds,milliseconds), and then use the instance's property——
DateTime dt = new DateTime(2010, 10, 10, 10, 5, 5,5);