Solved

Cant Insert date value in access database

Posted on 2004-09-27
5
135 Views
Last Modified: 2010-04-06
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?
0
Comment
Question by:ednugentcpa
5 Comments
 

Author Comment

by:ednugentcpa
ID: 12164801
Nevermind, I solved the problem.

For those who run into this situation, don't name your database field "Date" as that is a predefined term in ASP. I changed field to Date_Slot and everything worked fine.
0
 
LVL 2

Expert Comment

by:vdhant
ID: 12165797
you can give the points to me if you want ;)
ant
0
 
LVL 3

Expert Comment

by:Jankit141180
ID: 12216052
Before i submit , i wish to let u let u know a require thing to do  which i have understood from your problem statment.

YOu need to set the datatype for your database fields named 'Date' to 'Date/Time' and make its format to 'Medium Date'.

Then put '#' as prefix to your date variable. like ........

I have made a little change in the insert script mentioned by you.

 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 & "' )"


Still u were not able to solve the problem then put replace 'Date' (your database field) with '[Date]'.

You will definitely find a solution.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12471972
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now