Hi
I have got 2 dates that need to be stored on my access
database. arrival_date and departure_date. these values
are entered by a user who is making a room booking. What
i wanted to know is if there is a function in vb.net that
recognises this as an interval and therefore stops
bookings for the same room being made that falls between
this interval.
eg:
Booking 1 for room 1: arrival_date = 1/1/2000
deputure_date = 10/1/2000
Booking 2 for room 1: arrival_date = 5/1/2000
deputure_date =15/1/2000
the second booking will be allowed in my DB as it unique
although the room is not even available. what can i do to
avoid this?
any help would be grateful. 6 1631
Hi Eva,
Do you literally mean a VB.NET function?
ArrivalDate = #20/12/2003#
LeavingDate = #02/01/2004#
If NewBookingDate >= ArrivalDate _
And NewBookingDate <= LeavingDate Then
MsgBox ("Sorry, that room is taken.")
End If
or do you mean a database query type of test?
Regards,
Fergus
* "Eva" <an*******@discussions.microsoft.com> scripsit: I have got 2 dates that need to be stored on my access database. arrival_date and departure_date. these values are entered by a user who is making a room booking. What i wanted to know is if there is a function in vb.net that recognises this as an interval and therefore stops bookings for the same room being made that falls between this interval.
eg:
Booking 1 for room 1: arrival_date = 1/1/2000 deputure_date = 10/1/2000
Booking 2 for room 1: arrival_date = 5/1/2000 deputure_date =15/1/2000
the second booking will be allowed in my DB as it unique although the room is not even available. what can i do to avoid this?
Why not simply compare the date with the 2 dates?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
Hi fergus,
I meant a Database query test. I want to ensure that only
the rooms that are fully available for the date interval
specified by the user are retrievd from the database and
displayed to the user. i was worried that when the user
makes a booking and enters the arrival_date and
departure_date, that the booking will be allowed even if
it falls between the interval of another booking for the
same room. I want to avoid this scenario by making sure
that the 2dates entered are thought of as an entire
iinterval rather that individual dates.
Any advise?? -----Original Message----- Hi Eva,
Do you literally mean a VB.NET function?
ArrivalDate = #20/12/2003# LeavingDate = #02/01/2004#
If NewBookingDate >= ArrivalDate _ And NewBookingDate <= LeavingDate Then MsgBox ("Sorry, that room is taken.") End If
or do you mean a database query type of test?
Regards, Fergus
.
* "Eva" <a@k> scripsit: I meant a Database query test. I want to ensure that only the rooms that are fully available for the date interval specified by the user are retrievd from the database and displayed to the user. i was worried that when the user makes a booking and enters the arrival_date and departure_date, that the booking will be allowed even if it falls between the interval of another booking for the same room. I want to avoid this scenario by making sure that the 2dates entered are thought of as an entire iinterval rather that individual dates.
Notice that a separate group for ADO.NET related question is available:
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
Web interface:
<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>
If you don't get an answer here, you may want to post to the group
mentioned above.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Hi Eva,
Maybe Fergus is answering, but he went off to bed, he did made a terific
good example for me.
I can try to help you, but we are doing those things mostly in dataset
tables.
Therefore you would have probably to read in a big table of your database,
that is time consuming.
The best you can do, is to l find a solution using a database SQL query.
Those are for an access database less complete than for a full SQL server.
I think that the best thing you can do is placing this question in the
microsoft.public.dotnet.framework.adonet newsgroup (I saw you did not do
that till now).
There is handled a lot of this kind of question. Do you not succeed there,
than message it again here and tell you was in that newsgroup, although I am
a little bit active there also.
Than we can try how we can solve this problem by reading the part of the
database between those dates as a dataset and when we succeed in that, I am
sure we can solve your problem it in that way, using the thing Fergus did
describe.
But first take a look at the other newsgroup please because direct SQL is I
think better for this problem.
And dont forget to tell that you are using a ms access database and when
they tell you that an SQL database is better think
........................................
Cor
Hello Eva
I don't know your table structure but here is a suggested approach
RoomID int key
ResDate datetime
Reserved bit
You need a contiguos group of days lets say 4 days
SELECT RoomID FROM Reservations
WHERE (Reserverd = 0)
AND ( ResDate Between '1/1/2003' AND '1/4/2003')
HAVING Count >3
Such a query would give you all the rooms open during that period with 4
days avail.
You can modify this idea to suit your own structure
Ibrahim Malluf
"Eva" <a@k> wrote in message news:0c****************************@phx.gbl... Hi fergus,
I meant a Database query test. I want to ensure that only the rooms that are fully available for the date interval specified by the user are retrievd from the database and displayed to the user. i was worried that when the user makes a booking and enters the arrival_date and departure_date, that the booking will be allowed even if it falls between the interval of another booking for the same room. I want to avoid this scenario by making sure that the 2dates entered are thought of as an entire iinterval rather that individual dates.
Any advise?? -----Original Message----- Hi Eva,
Do you literally mean a VB.NET function?
ArrivalDate = #20/12/2003# LeavingDate = #02/01/2004#
If NewBookingDate >= ArrivalDate _ And NewBookingDate <= LeavingDate Then MsgBox ("Sorry, that room is taken.") End If
or do you mean a database query type of test?
Regards, Fergus
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Donnal Walter |
last post by:
I was very surprised to discover that
>>> import datetime
>>> x = datetime.date(2004, 9, 14)
>>> y = datetime.datetime(2004, 9, 14, 6, 43, 15)
>>> print x == y
True
How can these two...
|
by: androtech |
last post by:
Hello,
I'm looking for a function that returns a date range for a specified week
number of the year.
I'm not able to find functions like this anywhere. Any pointers/help would
be much...
|
by: Lynn |
last post by:
On a form I have
Date_Start Date_End
I have a new
Date_Start1 Date_End1 which the use
inputs.
I need to validate that Date_Start1 and...
|
by: DCM Fan |
last post by:
{CREATE TABLEs and INSERTs follow...}
Gents,
I have a main table that is in ONE-MANY with many other tables. For example, if
the main table is named A, there are these realtionships:
A-->B...
|
by: UBI |
last post by:
Vorrei suggerire una funzione completa per la differenza fra due date.
(questo è codice freeware, niente di illegale)
La funzione seguente permette il calcolo di una differenza precisa tra due...
|
by: JenHu |
last post by:
Hi expert,
I have a data field (birthdate) contains a datetime datatype
(mm/dd/yyyy), how can I convert to mmdd??
say, the birthday is 8/1/1979 and convert to mmdd
DOB =...
|
by: Daniel Kaseman |
last post by:
How do I convert a date into a serial number?
(I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR
show how close I am to the TO date.) get it?
I know that MS Excel...
|
by: Rsapru |
last post by:
i have a table containing following data
effdate termdate uid
----------- ----------- -----------
1 2 1
3 4 2
5 8 3
7 ...
|
by: pyotr |
last post by:
Simply my problem is:
I need to validate the StartDate and EndDate when entered for an employee through subform. the purpose is to avoid entering a date that violate or overlap date intervalS that...
|
by: Mike P |
last post by:
How would I write some Javascript to test whether a date is in the past
or not? I need to only accept either the current date or future dates.
*** Sent via Developersdex...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |