5
Answers

Date Format

djohncon

djohncon

20y
4.4k
1
Hi , thanks to all for my previous question on data insertion error. this time I have a problem with the format returned by toString() in windows forms; This Sample code returns 01/01/0001 regardless of the data entered. 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); DateTime ddt = new DateTime(); i++; t_ID.Text=i.ToString() ; // this format the same as shortDateTime.tostring() t_Dates.Text = ddt.ToString("dd/MM/yyyy"); statusBar.Text="Connected - Now you can Add records"; myConn.Close() ;
Answers (5)