Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 September 15th, 2004, 09:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi DMan,

Glad that it worked. (I wasn't checking my mails for the past 2 days, so I couldn't reply you)

Actually I was looking for some realtime data for the following from you, to have suggested a better solution.
1) What is value passed on as querystring.
2) What is value stored in DB
3) How is querystring value compared against Db value.

But I don't find it necessary to set that column default to Convert(char(10), getdate(), 101)

By default Sql server stores all datetime values in db as yyyy-mm-dd hh:mm:ss.000 format and any smalldatetime values as yyyy-mm-dd hh:mm:ss format. So it is enough that you incorporate that format in your where clause to compare that against the DB values.

Just when do a
SELECT smalldatetime_column FROM your_table
You should see that displayed in the format as mentioned above. Though you do a convert() to its default value, still I beleive it stores it in its format except that the time part is made all ZEROs. It is all in the way we pass the values as needed by the db.

Let me explain why it would have worked for you now. Because when you set it to default as just "getdate()" it uses the date with time too(current date & current time - when the value was inserted). But when you use convert() as mentioned, it defaults the value with currentdate and time as 00:00:00

So when you compare the QS values with db values, it is enough that you do like this.
Select * from Table where datecol = qsvalue
(where "2004-09-16 00:00:00" is equivalent to "2004-09-16")

But when it was defaulted to "getdate()", your query would have looked like
Select * from Table where datecol = qsvalue
(where "2004-09-16 01:30:36" is NOT equivalent to "2004-09-16")
That is where you need to strip of the time part on both the side(if exists) and convert comes in to use as I suggested in one of my replies earlier.

This is how it would have solved the problem for you, when you changed it to convert().

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Querystring Problem kaustic Beginning PHP 1 May 16th, 2007 07:47 AM
Problem with QueryString in ASP s.abraham ASP.NET 1.0 and 1.1 Basics 1 March 22nd, 2005 04:43 PM
QueryString Problem mims1979 Beginning PHP 3 January 10th, 2005 08:06 PM
Problem with Request.QueryString mg1966 Classic ASP Databases 4 January 7th, 2005 02:04 PM





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