I want to insert DateTime variable into database table column of DateTime2 type (from .net program) (im using sqlServer 2008, .net 4.0, c#)
now I have
string insertCommand = @"INSERT INTO X VALUES (time.ToString());
Problem is in time string format. SQL Server does not work with output from ToString() function. I also tried .ToLongDate short date etc.. How to create proper sql command and how to format dateTime string to make this work?