|
-
May 25th, 2010, 06:32 PM
#1
Thread Starter
Lively Member
Time Question
I am building a shuttle scheduler for our hotel and I want to enforce functionality with in it as follows:
1) I want the program to look through the database when a user inserts a shuttle run and look to see what other runs are for the day, and based on that information and the time of day that a guest is asking for it will either let it go through or kick back a message saying that their is not enough time. For instance, a shuttle run at 8:30am to a company that takes 30 minutes round trip (roundtriptextbox) and a guest wants a shuttle at 8:45am, it would say "Shuttle Time Not Allowed, Shuttle will be out!" or something like that because often times our front desk agents will schedule shuttles at any time with out qualm that the shuttle won't be back in time to pick them up. Any suggestions? Have I made it clear enough? I am using VS2010
-
May 26th, 2010, 12:53 AM
#2
Re: Time Question
This all can be solved using 1 select query from your db.
Pseudo code:
Code:
Select
[DepartTime]
From
[Schedule]
Where
([TimeInQuestion] >= [DepartTime])
And
([TimeInQuestion] <= [DepartTime + 30 mins])
If this query returns then [TimeInQuestion] is unacceptable.
-
May 26th, 2010, 07:24 PM
#3
Thread Starter
Lively Member
Re: Time Question
That query looks okay, but two things: (A) I am using a local database not SQL because it requires Service Pack 3 installed and we can't run SP3 because our Property Management System will fail, so we have to use SP2. (B) I'm confused as to where to put that query.
-
May 26th, 2010, 07:54 PM
#4
Re: Time Question
"I am using a local database not SQL"
Access,sql express,xml?
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
May 27th, 2010, 12:44 AM
#5
Re: Time Question
Even plain text files can be queried using SQL. You only need a proper connector.
-
May 27th, 2010, 09:33 AM
#6
Thread Starter
Lively Member
Re: Time Question
I'm still very new to VB, so what do you mean by proper connector? Do you have examples either by yourself or via the web that are understood by a 5th grader?
-
Jun 17th, 2010, 01:20 PM
#7
Thread Starter
Lively Member
Re: Time Question
I placed that in exactly except I changed my field names to what was in my database, such as DepartTime = Time and Scheduler to ShuttleRuns but I got an error, which was saying "TimeInQuestion" was not a valid Node
-
Jun 17th, 2010, 01:25 PM
#8
Lively Member
Re: Time Question
What type of database is it? Can you give us an example?
-
Jun 17th, 2010, 01:53 PM
#9
Thread Starter
Lively Member
Re: Time Question
Well here is my code that I used in the Query Wizard
[CODE]SELECT DepartTime
FROM ShuttleRuns
WHERE (TimeInQuestion >= Time) AND (TimeInQuestion <= [Time + 30 mins])CODE]
And I either get an error that says: " The column name is not valid. [Node name (if any)= , Column name = TimeInQuestion]
OR
When I click "Add New" on my form and leave the Time Box it clears out the entire form.
-
Jun 17th, 2010, 02:39 PM
#10
Thread Starter
Lively Member
-
Jun 17th, 2010, 05:13 PM
#11
Lively Member
Re: Time Question
http://www.connectionstrings.com/sql-server-2005-ce
thats what's meant by a proper connector )
PS is there a column on your database called " time in question" i doubt it??
Last edited by Joshwah!; Jun 17th, 2010 at 05:19 PM.
-
Jun 20th, 2010, 09:28 AM
#12
Thread Starter
Lively Member
Re: Time Question
Yeah, none of those worked, I got squiggly lines.
-
Jun 20th, 2010, 07:23 PM
#13
Re: Time Question
Try to put () instead of [] here:[Time + 30 mins]
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
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
|