Hey guys,
Am having a small issue with inserting some data into a table...
Basically, I need to insert a date into a table. I am trying to do it as follows (some code omitted):
Now I have looked at the string that is generated (output it to a messagebox, and the problem is that when converting the date variables to string, the output is in the following format: DD\MM\YYYY 00:00:00.
Obviously, when passing this to the DB, the app crashes. Now, is there anything I can do to get rid of the time portion at the end of each Date?
Am having a small issue with inserting some data into a table...
Basically, I need to insert a date into a table. I am trying to do it as follows (some code omitted):
Code:
Dim DB_CMD As NewOleDB.OleDbCommand
Dim strDB_CMD
Dim ResStartDate As Date
Dim ResEndDate As Date
'Stuff to declare Connection, assign values to variables, etc...
strDM_CMD = "INSERT INTO Reservation (ReservationDate, StartDate, EndDate) VALUES
(Convert.ToString(System.DateTime.Now.Date)
& "," & Convert.ToString(ResStartDate)& "," & Convert.ToString(ResEndDate) & ")"
DB_CMD.CommandText = strDB_CMD
DB_CMD.ExecuteNonQuery
Now I have looked at the string that is generated (output it to a messagebox, and the problem is that when converting the date variables to string, the output is in the following format: DD\MM\YYYY 00:00:00.
Obviously, when passing this to the DB, the app crashes. Now, is there anything I can do to get rid of the time portion at the end of each Date?