Cant Insert date value in access database
Posted on 2004-09-27
Here's my code:
iTime_Slot = (myDataReader.Item("Time_Slot"))
iDate = (myDataReader.Item( "Date"))
DBInsert.CommandText = "Insert Into Attendees " _
& "(First_Name, Last_Name, Company, Address, City, State, Zip, Phone, Domain_Name, Email, Date, Time_Slot)" _
& "values ( '" & First_Name & "','" & Last_Name & "','" & Company & "','" & Address1 & "','" & City & "','" & State & "','" & Zip & "','" & TotalPhone & "','" &
Website & "','" & Email & "','" & zDate & "','" & iTime_Slot & "' )"
Suffice it to say, the date & time selected by user are successfully passed to the variables iTime_Slot & iDate. Moreover, in SQL string I have no problem repassing the iTime_Slot time to the 2nd table. I cannot seem to pass date though. I am very frustrated as the values I am trying to pass to the second table, while the user makes his choice, are nonetheless coming from fields in the first table. In borth tables, date ad time have the same data type, i.e. Date/Time. So naturally, I am ervy frustrated.
Does anyone have the solution of passing the date variable, selected by user from table 1 into the date field of table 2?