Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 12th, 2008, 07:15 AM
Authorized User
Join Date: Feb 2008
Location: Bangalore, A.P, India.
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....

  #2 (permalink)  
Old March 12th, 2008, 08:39 AM
Authorized User
Join Date: Sep 2007
Location: , , Finland.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts

Functions DATEPART and GETDATE are you friends.

  #3 (permalink)  
Old March 12th, 2008, 05:02 PM
Authorized User
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts


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 :)

  #4 (permalink)  
Old March 12th, 2008, 06:06 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

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:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========

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
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

All times are GMT -4. The time now is 01:48 PM.

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