Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 25th, 2004, 06:22 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old August 25th, 2004, 08:39 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Mentiri, Muara, Brunei.
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.


Reply With Quote
  #3 (permalink)  
Old September 4th, 2004, 02:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:07 AM.


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