Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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 March 12th, 2008, 07:15 AM
Authorized User
 
Join Date: Feb 2008
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default comparing date column with sql server

I got a datecolumn Exp_Date in an sql table.I want to display only records of current date in a gridview.I am using sqldatasource to bind to the gridview.In html what should i give in the selectcommand like
selectcommand="Select * from mytable where Exp_Date>=getdate"?????

its very urgent....

Regards,
AMR
 
Old March 12th, 2008, 08:39 AM
Authorized User
 
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Functions DATEPART and GETDATE are you friends.

http://msdn2.microsoft.com/en-us/library/ms174420.aspx
http://msdn2.microsoft.com/en-us/library/ms188383.aspx
 
Old March 12th, 2008, 05:02 PM
Authorized User
 
Join Date: Feb 2008
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Weico,

I want to use getdate() function in sqldatasource's selectcommand like
select * from sometable where datecol>='<%DateTime.Parse(DateTime.Now.ToShortDat eString()%>' in HTML page i.e UI page.But instead of the above i shall use ServerSide dateTime using GetDate().How to get records in a gridview using GETDATE();

Thanks in Advance and Thanks for Replying Buddy :)

AMR
 
Old March 12th, 2008, 06:06 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I don't understand. Calling Getdate() directly in your SELECT statement should return you the current date on the SQL Server. Maybe I missed something.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with comparing date fields JimmyNeutron Access VBA 3 February 22nd, 2005 09:14 AM
describe SQL Server 8 column collation bobcorrick SQL Server 2000 2 November 8th, 2004 06:56 AM
SQL Server Date sankar SQL Server 2000 2 December 19th, 2003 07:48 AM
Comparing Dates in SQL Server 7 chiefouko SQL Server 2000 8 August 6th, 2003 06:39 PM
SQL Server date column and ASP treadmill SQL Server 2000 1 July 7th, 2003 08:51 AM





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