Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2004, 06:22 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting Problem in DATE/TIME Data type in MS Acces

Hi,

I am getting problem in DATE/TIME data type in MS Access data base using ASP forms, Following is the senario.

There are three DATE/TIME field in MS Access, Date1, Date2, Date3 and I have three text boxes in ASP, from where i am entering dates. If i enter only one date in one text box and rest of them are null and when i click on submit button then the insert into qurey will fire and then it give me an error "Data Type mismatch", insted of if i enter the three dates in text box it's accept the data and post into to database.

Rather then i write a check in ASP that if the text box is "" means Empty then it insert word "NULL" not "" in date/time field in database but again it's give me an error Data type mismatch because it's not acsept word NULL in date/time data type.

What would i do if don't want to enter date in rest of 2 Date/Time field??? because it's dosen't accepting word NULL or empty value in database.
 
Old August 25th, 2004, 08:39 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

   Date/Time data type could not accept null values. Other wise you insert default date if you dont want to enter date at input.

Or change the datatype of date field to text. Then it accepts any type of value.

In the insert statement, it cannot accept NULL in the date feidl.


 
Old September 4th, 2004, 02:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi selam70,

Set the "Default Value" of Date/Time Field in table's design to some valid date values, for columns that you would wish to ignore entering values on the asp page. And when constructing INSERT statement, don't include those date/time columns that are not entered with values on the ASP page.

Changing the date/time to TEXT would result on other problems in future like comparing/calculating date/time values, also If time is involved for any such calculations, then you would have to manipulate separately or convert from string to date everytime calculcation is required. So I won't suggest you change the datatype.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Acces Autonumber teddyk ASP.NET 2.0 Basics 7 October 22nd, 2008 09:07 PM
MS Date Time picker change Paulys72 Access 1 August 20th, 2007 06:21 AM
Syntax to query Date/Time in MS ACCESS chiuyianl Access 4 March 31st, 2005 09:08 AM
Dataset Time data type jaucourt VB.NET 2002/2003 Basics 0 May 21st, 2004 08:48 AM
Compile Time Data Type Checking c3nty@yahoo.com C# 0 September 18th, 2003 01:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.