Help! urgent! How do u insert time into database
Help! urgent! How do u insert time into database
here is my code : i'm getting errors in the database after a successfull insert: the database StartTime field is format is set to h\nn\ss AM/PM
but when instead of inserting the time from Today.ToLongDateString
it give me 12:00:00 AM and if u click on it it give u the defult date
>.<
i don't know what is wrong i just wanted Time in the data field and not stupid date thing cos if i fill from that database i get the date in the dataset instead of the defult time say 12:00:00 which the time is incorrect as well ><
Me.OleDbConnection2.Open()
'Insert into database
Me.OleDbDataAdapter1.InsertCommand.Parameters("Date").Value = Today.ToShortDateString
Me.OleDbDataAdapter1.InsertCommand.Parameters("StartTime").Value = Today.ToLongTimeString
Me.OleDbDataAdapter1.InsertCommand.Parameters("FinishTime").Value = DateTime.Now
Try
' Execute insert statement
i = Me.OleDbDataAdapter1.InsertCommand.ExecuteNonQuery()
'Catch any errors
Catch OleDBError As System.Data.OleDb.OleDbException
MsgBox("error is " + OleDBError.ToString)
End Try
OleDbConnection2.Close()