|
-
Jan 16th, 2003, 02:41 PM
#1
Thread Starter
Junior Member
SQL query
Any ideas on how to write a query which verifies availability for an equipment by checking on the date, time and item, to make sure it's not already being used ?
-
Jan 16th, 2003, 05:18 PM
#2
Frenzied Member
How are you going to compare them? by user input or something else?
if user input then
let's say you have 3 textboxes date, time and item
the you could do this to search for a specific item
SELECT * FROM tablename WHERE date <> '" & txtDate.Text & "' AND time <> '" & txtTime.Text & "' AND item = '" & txtItem.Text & "'"
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jan 17th, 2003, 07:40 AM
#3
Thread Starter
Junior Member
The date will be in an interval (startdate to enddate) specified on two comboboxes, so will be the time.
-
Jan 17th, 2003, 03:08 PM
#4
Frenzied Member
if you want to search between 2 dates and 2 times then it would be
Code:
SELECT * FROM tablename WHERE date BETWEEN '" & txtDate1.Text & "' AND '" & txtDate2.Text & "' AND time BETWEEN '" & txtTime1.Text & "' AND '" & txtTime2.Text & "' AND item = '" & txtItem.Text & "'"
The syntax maybe a little different depending on the database you are using.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jan 17th, 2003, 03:14 PM
#5
Thread Starter
Junior Member
Thanks, but how do you compare the time? Do you have to assign a specific data type to this variable or control so that you can compare what's in the recordset with the users' input?
-
Jan 17th, 2003, 03:28 PM
#6
Frenzied Member
yes, make sure the datatype of the varaible holding the users input is the same as that in the database.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|