Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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 November 30th, 2009, 08:28 AM
Authorized User
 
Join Date: Mar 2009
Posts: 74
Thanks: 5
Thanked 0 Times in 0 Posts
Default how can I compare dates in a sqlserver database to

Please how can I compare dates in a sqlserver database to dates on a calendar in order to determine the dates that a particalar room is free for booking.

I am trying to create a room reservation system, however I am having some strains.
here is what I am trying to do:
a customer should be able to view available dates for a particular room.I mean dates on which this room is free, so that he does not book a room that has already been taken on the time period he specifies he will be staying in the hotel.
please can anyone give me some help on this?

. Or is there another way I can do this. Thanks
 
Old December 3rd, 2009, 04:19 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

This is what I have done in the past. I created a datatable with all the info I needed, including the date(s) needed. Then, in the DayRender event of the calendar, I looped through all the rows in the datatable and compared the dates:

Code:
ForEach dr As DataRow In dt.Rows
  IfDirectCast(dr("YourDateColumn"), DateTime).Date = e.Day.Date Then
     .. DO STUFF HERE
End If
 
Old December 4th, 2009, 07:02 AM
Authorized User
 
Join Date: Mar 2009
Posts: 74
Thanks: 5
Thanked 0 Times in 0 Posts
Default Thanks

Thanks alot, lot, will try the code, but could U help convert the code to c#, am kind of a rookie programmer and have little experience with vb...

thanks .
 
Old December 4th, 2009, 11:00 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

There are code converters on-line. Just use Google.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare two dates lakshmi_annayappa Javascript 1 September 3rd, 2007 08:52 AM
How do I compare 2 dates? Lucy Classic ASP Basics 1 May 3rd, 2005 07:24 PM
Compare dates langer123 Classic ASP Basics 2 April 16th, 2005 08:57 AM
Compare dates [problem]... Varg_88 VB Databases Basics 3 August 20th, 2004 09:55 AM
Compare Dates in JS apd8x Javascript 4 June 16th, 2003 08:27 AM





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