Need second pair of eyes on ASP query (into Access DB)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Need second pair of eyes on ASP query (into Access DB)

    OK, it's been a while since I've written a JOIN for Access ;) so could
    someone take a look at this and tell me what's wrong with it? All columns
    exist, and data types are correct...

    sqlQuery = "select trip.tripname,trip.trialhead,trip.startdate from trips
    trip inner join users usr on usr.username=trip.username where
    usr.userticket='" & userTicket & "' and trip.enddate>#" & Date() & "# order
    by trip.startdate,trip.tripname"

    Getting error "Too few parameters. Expected 1"


    Thanks!
    Jack



    Jack Black Guest

  2. Similar Questions and Discussions

    1. Need fresh pair of eyes
      Hey all. I have a flash video recorder set up to do some encoding, and based on the users input to where they want the connection stream to for a...
    2. 2nd set of eyes please
      This is not a complicated piece of code, but I can't seem to figure out why I keep getting this error. Context validation error for tag cfif....
    3. CRT or LCD / TFT - which one is best for eyes ?
      I still have concerns about the actual radiation levels coming off CRT's. I don't know if it's my middle age, genes or the CRT accelerating my road...
    4. pair values
      > hi i was wondering if a property list can contain pair values i.e. you would want a list of lists addprop thisList, item2, resulting...
    5. Can I get a second pair of eyes on this sort ...
      Found this great store locator script, tweaked it - works great - except: Having trouble getting it to sort by distance ($dist). I'm sure I'm...
  3. #2

    Default Re: Need second pair of eyes on ASP query (into Access DB)

    Jack Black wrote:
    > OK, it's been a while since I've written a JOIN for Access ;) so could
    > someone take a look at this and tell me what's wrong with it? All
    > columns exist, and data types are correct...
    >
    > sqlQuery = "select trip.tripname,trip.trialhead,trip.startdate from
    > trips trip inner join users usr on usr.username=trip.username where
    > usr.userticket='" & userTicket & "' and trip.enddate>#" & Date() & "#
    > order by trip.startdate,trip.tripname"
    >
    > Getting error "Too few parameters. Expected 1"
    >
    >
    > Thanks!
    > Jack
    Where's your "response.write sqlQuery"? How can you expect to troubleshoot a
    query without looking at it? Looking at the vbscript statement that assigns
    the sting of characters representing a potential query statement to a
    variable is not the same thing as looking at the query itself. Do a
    response.write. Then copy the resulting statement from the browser windo
    into the SQL View of an Access Query Builder and attempt to run it. If you
    can't see what the problem is by looking at the query, you should at least
    get a better (more helpful) error message from Access than the one you get
    from the Jet database engine.

    One thing I can suggest is to change this:
    " ... and trip.enddate>#" & Date() & "# ... "

    to this:
    " ... and trip.enddate> Date() ... "

    The Jet engine can run some VBA functions, including the Date function, so
    you don't have to concatenate the value returned from the function into the
    string.

    HTH,
    Bob Barrows


    Bob Barrows Guest

  4. #3

    Default Re: Need second pair of eyes on ASP query (into Access DB)

    Bob, thanks for responding...

    As for outputting the string value, it looks as you would expect it to (ie,
    typical Access SQL statement); that was the first thing I did when the error
    first appeared. I changed the JOIN operation to a simple two-table query
    and it worked perfectly, so I'm leaning toward a JOIN issue in the
    supporting Access driver.

    Thanks for the suggestion on the Date() method; I'll certainly try that next
    time. The reason I left it the way it is was because I want to maintain a
    standard style for all date-related formats in SQL queries.

    Thanks,
    Jack


    "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    news:%23MJZOFyeDHA.2356@TK2MSFTNGP12.phx.gbl...
    >> Where's your "response.write sqlQuery"? How can you expect to
    troubleshoot a
    > query without looking at it? Looking at the vbscript statement that
    assigns
    > the sting of characters representing a potential query statement to a
    > variable is not the same thing as looking at the query itself. Do a
    > response.write. Then copy the resulting statement from the browser windo
    > into the SQL View of an Access Query Builder and attempt to run it. If you
    > can't see what the problem is by looking at the query, you should at least
    > get a better (more helpful) error message from Access than the one you get
    > from the Jet database engine.
    >
    > One thing I can suggest is to change this:
    > " ... and trip.enddate>#" & Date() & "# ... "
    >
    > to this:
    > " ... and trip.enddate> Date() ... "
    >
    > The Jet engine can run some VBA functions, including the Date function, so
    > you don't have to concatenate the value returned from the function into
    the
    > string.
    >
    > HTH,
    > Bob Barrows
    >
    >

    Jack Black Guest

  5. #4

    Default Re: Need second pair of eyes on ASP query (into Access DB)

    Jack Black wrote:
    > Bob, thanks for responding...
    >
    > As for outputting the string value, it looks as you would expect it
    > to (ie, typical Access SQL statement); that was the first thing I did
    > when the error first appeared. I changed the JOIN operation to a
    > simple two-table query and it worked perfectly, so I'm leaning toward
    > a JOIN issue in the supporting Access driver.

    What? It sounds like you completely missed my point (I guess i did not
    explain myself well enough). What appears in the browser window when you
    change your code to this:

    sqlQuery = "select trip.tripname,trip.trialhead,trip.startdate from trips
    trip inner join users usr on usr.username=trip.username where
    usr.userticket='" & userTicket & "' and trip.enddate>#" & Date() & "# order
    by trip.startdate,trip.tripname"
    response.write sqlQuery
    response.end

    and run the page?

    If this concatenation (the creation of the sql statement) has been done
    correctly, you should have a statement in the browser window that you can
    copy to the clipboard and (after opening your database in Access, creating a
    new query and switching to SQL View) paste into the Query Builder's SQL View
    and run without modification. Tell us what happens when you try this.

    We cannot be expected to troubleshoot this query without
    a) knowing what the actual query is (the result of response.write)
    and
    b) knowing the structure of the tables involved in the query.

    The "Too few Parameters" error means that your query includes a word that
    the query parser cannot recognize, usually due to a misspelling of a column
    name. It has nothing to do with your joins. The advantage of using Access to
    troubleshoot this query will quickly become apparent to you when you try to
    run it in Access and Access prompts you to provide the value for the word in
    your query that the query parse does not recognize.

    HTH,
    Bob Barrows


    Bob Barrows Guest

  6. #5

    Default Re: Need second pair of eyes on ASP query (into Access DB)

    I second Bob's comments. We need to see what you're actually sending to the
    database - not the bits your concatenating in VBScript.

    That said:
    [url]http://www.adopenstatic.com/faq/80040e10.asp[/url]
    lists common causes of this problem, including mis-spelt column names (which
    is the most common cause)

    Cheers
    Ken

    "Jack Black" <jackblackisback@hotmail.com> wrote in message
    news:uC1Erg2eDHA.556@TK2MSFTNGP11.phx.gbl...
    : Bob, thanks for responding...
    :
    : As for outputting the string value, it looks as you would expect it to
    (ie,
    : typical Access SQL statement); that was the first thing I did when the
    error
    : first appeared. I changed the JOIN operation to a simple two-table query
    : and it worked perfectly, so I'm leaning toward a JOIN issue in the
    : supporting Access driver.
    :
    : Thanks for the suggestion on the Date() method; I'll certainly try that
    next
    : time. The reason I left it the way it is was because I want to maintain a
    : standard style for all date-related formats in SQL queries.
    :
    : Thanks,
    : Jack
    :
    :
    : "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    : news:%23MJZOFyeDHA.2356@TK2MSFTNGP12.phx.gbl...
    : >> Where's your "response.write sqlQuery"? How can you expect to
    : troubleshoot a
    : > query without looking at it? Looking at the vbscript statement that
    : assigns
    : > the sting of characters representing a potential query statement to a
    : > variable is not the same thing as looking at the query itself. Do a
    : > response.write. Then copy the resulting statement from the browser windo
    : > into the SQL View of an Access Query Builder and attempt to run it. If
    you
    : > can't see what the problem is by looking at the query, you should at
    least
    : > get a better (more helpful) error message from Access than the one you
    get
    : > from the Jet database engine.
    : >
    : > One thing I can suggest is to change this:
    : > " ... and trip.enddate>#" & Date() & "# ... "
    : >
    : > to this:
    : > " ... and trip.enddate> Date() ... "
    : >
    : > The Jet engine can run some VBA functions, including the Date function,
    so
    : > you don't have to concatenate the value returned from the function into
    : the
    : > string.
    : >
    : > HTH,
    : > Bob Barrows
    : >
    : >
    :
    :


    Ken Schaefer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139