I am using TableAdapters to connect to a mySQL database that contains a DateTime column. Is there a way to pass a DateTime value from .Net (C#) to a database containing a DateTime column? MSFT and mySQL apparently store dates differently.
Thx
Scott
Using TableAdapter That Contains DateTime
Explanation of what I am doing
I am using a TableAdapter to connect to a mySql database. For background on TableAdapters please see (http://weblogs.asp.net/scottgu/archive/ ... 35498.aspx).
In its most simplified form I have a web form with a single textbox and a submit button. The user enters a date / time in text format as ASP.Net expects it to occur (i.e., MM/DD/YYYY, 1/1/2001). The value from the text box is stored in a DateTime variable.
I would then like to insert this DateTime value (1/1/2001) into a mySql database table with a mySQL date time column. My understanding is that mySQL treats date time variables differently than ASP.Net and expects them to come in as YYYY/MM/DD.
I know I can convert the ASP.Net variable to a string and successfully do an insert if the column is varchar but what I really want to do is insert into an ASP.NET DateTime variable into a mySql column.
Because the tableadapter enforces compile time type checking I do not have the option of passing a mySql reformatted string to the database.
Thank you for your help.
In its most simplified form I have a web form with a single textbox and a submit button. The user enters a date / time in text format as ASP.Net expects it to occur (i.e., MM/DD/YYYY, 1/1/2001). The value from the text box is stored in a DateTime variable.
I would then like to insert this DateTime value (1/1/2001) into a mySql database table with a mySQL date time column. My understanding is that mySQL treats date time variables differently than ASP.Net and expects them to come in as YYYY/MM/DD.
I know I can convert the ASP.Net variable to a string and successfully do an insert if the column is varchar but what I really want to do is insert into an ASP.NET DateTime variable into a mySql column.
Because the tableadapter enforces compile time type checking I do not have the option of passing a mySql reformatted string to the database.
Thank you for your help.