Every time this error problem with dt.
strSql = string.Format("Insert InTo MoneyEntries (Amount, EntryDate, Description, IDCategory)" +
"Values ('{0}', '{1}', '{2}', '{3}')", am, dt, desc, int.Parse(rdr[0].ToString()));
In my table Entrydate have type easy date. Please help
Loading
VulpesPosted Jul 18, 2011, 8:31 AM
strSql = "Insert InTo MoneyEntries (Amount, EntryDate, Description, IDCategory) Values ('" + am.ToString() + "','" + dt.ToString("MM/dd/yyyy") + "','" + desc.ToString() + "','" + rdr[0].ToString() +"')'";
Mike JonsonPosted Jul 18, 2011, 9:54 AM
VulpesPosted Jul 18, 2011, 9:01 AM
Mike JonsonPosted Jul 18, 2011, 8:43 AM
Mike JonsonPosted Jul 18, 2011, 7:41 AM
Mike JonsonPosted Jul 18, 2011, 7:00 AM
Dorababu MekaPosted Jul 18, 2011, 6:13 AM
dt.ToUniversalTime().ToString(CultureInfo.CurrentCulture)
VulpesPosted Jul 18, 2011, 6:04 AM
We had another thread on this problem recently (http://www.c-sharpcorner.com/Forums/Thread/131973/inserting-date-value.aspx).
Also I'm surprised it works at all without a space before 'Values'.
I'd also remove the single quotes for the int value.
Mike JonsonPosted Jul 18, 2011, 6:00 AM
Mike JonsonPosted Jul 18, 2011, 5:57 AM
Dorababu MekaPosted Jul 18, 2011, 5:53 AM