Results 1 to 13 of 13

Thread: Time Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Angry 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

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Angry 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.

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Time Question

    "I am using a local database not SQL"
    Access,sql express,xml?
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  5. #5

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Angry 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?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    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

  8. #8
    Lively Member
    Join Date
    May 2010
    Posts
    103

    Re: Time Question

    What type of database is it? Can you give us an example?

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    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.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Re: Time Question

    PS: It's a .sdf database

  11. #11
    Lively Member
    Join Date
    Apr 2010
    Location
    York, Uk
    Posts
    103

    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.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Re: Time Question

    Yeah, none of those worked, I got squiggly lines.

  13. #13
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    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
  •  



Click Here to Expand Forum to Full Width