Please can any body show me examples on how to enter values into the Date and Time column
is it possible to enter a time value like this TimeSpan.Parse("00:00:00") and a date value like this
There some of my columns that i dont want to enter a date into it at time of seeding my database e.g. a column like LastPasswordChangedDate in admin table
At time of creation of an admin user, he does not have a value for that column. I dont know if I should just make the table nullable, so I pass a null value.
A DateTime is accepted, but am not sure for the TimeSpan. I think not, because it represents a length of time, not a point in time.
The link was to MySQL, I assume you're using MSSQL.
yes I am using Mssql. Well on mssql TimeSpan.Parse("00:00:00") accepts this. I can seed my database with that value.
But the problem is actually DateTime.Parse("0000/00/00") when I try to seed the database, it does not insert a value in the row.
Try converting to SqlDateTime, and remember ... SQL Server does not recognize dates prior to 1/1/1753
tans. that means I can not enter dates in this format 00/00/0000.
Does sql accept nullable types for date.
NULL is accepted if you specified the column as nullable.
tans pritaeas you the best
use this code in ur query
string qry = "insert into table_test(datefield)values(getdate())";