Solved

Cant Insert date value in access database

Posted on 2004-09-27
5
142 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

839 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