Date Insertion returns incorrect date
Hi, I have a two field program to simplfy the code to find the error returned by date.
The program is Window forms and the Database is MS Acess with OLEDB connection.
The date 31/12/1899 is returned to the DataBase regardless of what data is entered and the format is South Pacific Date dd/MM/yyyy.
I have tried every type of conversion for example :
Convert, Parse, IFormatProvider, Etc.
I have sample code of the insertion block:
strInsert += t_ID.Text+", ";
strInsert += t_Dates.Text+")";
OleDbCommand inst = new OleDbCommand(strInsert,myConn) ;
//Execute the statement
inst.ExecuteNonQuery() ;
statusBar.Text="Data Added to Database " ;
//reset all the textboxes
int i=int.Parse(t_ID.Text);
System.DateTime ddt = DateTime.Parse(t_Dates.Text,System.Globalization.CultureInfo.CreateSpecificCulture("en-AU").DateTimeFormat);
ddt.ToString("dd/MM/yyyy");
i++;
t_ID.Text=i.ToString();
t_Dates.Text = ddt.ToString("d");
t_Dates.Text = "";
statusBar.Text="Connected - Now you can Add records";
myConn.Close() ;
I hope someone can help?
kamean