-
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
-
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.
-
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.
-
Re: Time Question
"I am using a local database not SQL"
Access,sql express,xml?
-
Re: Time Question
Even plain text files can be queried using SQL. You only need a proper connector.
-
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? :)
-
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
-
Re: Time Question
What type of database is it? Can you give us an example?
-
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.
-
Re: Time Question
-
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??
-
Re: Time Question
Yeah, none of those worked, I got squiggly lines.
-
Re: Time Question
Try to put () instead of [] here:[Time + 30 mins]