?
Solved

Cant Insert date value in access database

Posted on 2004-09-27
5
Medium Priority
?
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

743 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