ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 13th, 2006, 06:43 AM
CrrazyChaz CrrazyChaz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 3 CrrazyChaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 42 sec
Reputation Power: 0
Question Searching For Conflicting Bookings

Hi there Folks,

Got a bit of a problem, and hoping someone out there can shed some light on the matter. I've set up a simple aircraft booking system, and have got to the part where the database searches for conflicting bookings.

Booking Already In DB:

Depart Date 01/08/06
Depart Time 08:00
Arrive Date 02/08/06
Arrive Time 20:00

Now if you try and make a booking such as:

Depart Date 01/08/06
Depart Time 07:45
Arrive Date 02/08/06
Arrive Time 15:00

Then it will flag up a conflict... HOWEVER, if you make the following booking (IE, only spans across 1 day)...

Depart Date 01/08/06
Depart Time 08:00
Arrive Date 01/08/06
Arrive Time 20:00

...Then it allows you to book the conflict! Can Anyone Help?!

Here's The Code...

Code:
qry="SELECT * FROM tblBookings"
qry=qry & " WHERE "
qry=qry & "(tblbookings.fromtime >= #" & FormatDateTime(Request.Form("fromtime"), 4) & "# AND "
qry=qry & "tblbookings.totime <= #" & FormatDateTime(Request.Form("totime"), 4) & "#) AND "
qry=qry & "(tblbookings.fromdate >= #" & FormatDateTime(Request.Form("fromdate"), 1) & "# AND "
qry=qry & "tblbookings.todate <= #" & FormatDateTime(Request.Form("todate"), 1) & "#) AND "
qry=qry & "tblbookings.aircraft_reg = '" & Request.Form("aircraft_reg") & "'"
Set Result1 = myConn.Execute(QRY)

if Result1.EOF = true then

'Create Record

sql="INSERT INTO tblBookings ([user],[aircraft_reg],[fromdate],"
sql=sql & "[fromtime],[todate],[totime],[remarks])"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("user") & "',"
sql=sql & "'" & Request.Form("aircraft_reg") & "',"
sql=sql & "'" & Request.Form("fromdate") & "',"
sql=sql & "'" & Request.Form("fromtime") & "',"
sql=sql & "'" & Request.Form("todate") & "',"
sql=sql & "'" & Request.Form("totime") & "',"
sql=sql & "'" & Request.Form("remarks") & "')"

'response.write sql
Myconn.Execute SQL,recaffected

'find ref of new entry
'Query = "SELECT id FROM tblBookings"
'Set Result = myConn.Execute(Query)
'while not Result.EOF 
'id = Result("id")
'Result.MoveNext
'Wend
Response.Redirect "bookings.asp"
'Response.Redirect "viewnews.asp?id="&id
else
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Please Wait...</title></head>
<% 
response.redirect "dupbookings.asp?aircraft_reg="& Request.Form("aircraft_reg") &"&fromdate="& Request.Form("fromdate") &"&todate="& Request.Form("todate") &"&fromtime="& Request.Form("fromtime") &"&totime="& Request.Form("totime")
end if
%>
<body>

</body>
</html>


Can Anyone Shed Any Light On The Matter?

Thanks :-)

Reply With Quote
  #2  
Old April 2nd, 2007, 01:41 PM
CrrazyChaz CrrazyChaz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 3 CrrazyChaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 42 sec
Reputation Power: 0
Talking Problem Solved!!

Hi folks,

Happy to report that I've solved the problem I posted on here ages ago. I thought I'd let you know the answer just in case anyone else falls upon the problem...

Code:
qry="SELECT * FROM tblBookings"qry=qry & " WHERE "
qry=qry & "((#"&fromdate&"# BETWEEN tblbookings.fromdate AND tblbookings.todate"qry=qry & " OR "
qry=qry & "#"&todate&"# BETWEEN tblbookings.fromdate AND tblbookings.todate)"qry=qry & " OR "
qry=qry & "(tblbookings.fromdate BETWEEN #"&fromdate&"# AND #"&todate&"#"qry=qry & " OR "
qry=qry & "tblbookings.todate BETWEEN #"&fromdate&"# AND #"&todate&"#)) AND "
qry=qry & "tblbookings.aircraft_reg = '"&Request.Form("aircraft_reg")&"'"
Set Result1 = myConn.Execute(QRY)
if Result1.EOF = true then

'Create Record



Reply With Quote
  #3  
Old November 7th, 2009, 07:19 PM
tinahelpusa tinahelpusa is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: US
Posts: 3 tinahelpusa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 56 sec
Reputation Power: 0
Hello everybody!

Hi,My name is Tina.I'm excited to be part of this large and growing forum of great people and thankyou all for making me feel welcome. I just joined today.My special interests or skills are:- HTML- SEO- Web design- Internet businessI am happy to help others that need it and offer advice where possible

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Searching For Conflicting Bookings


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek