Solved

Cant Insert date value in access database

Posted on 2004-09-27
5
131 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
Comment Utility
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
Comment Utility
you can give the points to me if you want ;)
ant
0
 
LVL 3

Expert Comment

by:Jankit141180
Comment Utility
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
Comment Utility
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

762 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

13 Experts available now in Live!

Get 1:1 Help Now