I want to insert current date into a database in the field cur_dt having datatype date.
string curr_dat= DateTime.Now.ToString("yyyy-mm-dd");
Can i insert curr_dat which is a string variable into a column cur_dt having datatype as date?
If not than how can i do it? How to define a date variable.I want to also insert current time in the a column cur_tm having datatype time.
Please help me to understand how to insert the date and time into the database.
If you write SQL like
or similar, you can use both parameters or just String.Format to put the date there as a STring.
Additionally, if you want to put the current Date/Time there, why not just use
and have the database set in the correct date in the correct form