Link to home
Create AccountLog in
Avatar of Bob_Everard
Bob_Everard

asked on

How do I get SELECT to believe that I have enough parameters?

I am trying to select some stuff from a "Standard Jet DB", but receive a mass of different error messages, the simplest of which is:

Message:   [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
SQLState:  07001
ErrorCode: -3010

There's a column in AlbumCustom called Custom09, the last 3 digits of which I use as a sequence number. Preceding digits indicate other characteristics. I am using the following query.

I understand that the problem is the variable Seq. What I DON'T understand is how, if I'm given the opportunity to do the MID(...) as Seq, to the USE Seq in the query.
private String qString = "SELECT Custom09,                 " +
                         " MID(Custom09,4,3) AS Seq        " +
                         "FROM AlbumCustom                 " +
                         "WHERE  Custom09 > 410000         " +
                         "AND    Custom09 < 500000         " +
                         "ORDER BY Seq                     ";

Open in new window

Avatar of ee_rlee
ee_rlee
Flag of Philippines image

hi, try

private String qString = "SELECT Custom09,                 " +
                         " MID(Custom09,4,3) AS Seq        " +
                         "FROM AlbumCustom                 " +
                         "WHERE  Custom09 > 410000         " +
                         "AND    Custom09 < 500000         " +
                         "ORDER BY MID(Custom09,4,3)     ";
Avatar of Bob_Everard
Bob_Everard

ASKER

Thanks, ee rlee, that worked of course.

I can get exactly the same result by removing the "AS Seq". So what's the effect/point of specifying the "AS Seq", if I'm unable to make any use of it, unless it's ONLY so that I can, if I want, have a column header of "Seq"? That's assuming I'm using something which displays column headers, which I'm not.

ASKER CERTIFIED SOLUTION
Avatar of ee_rlee
ee_rlee
Flag of Philippines image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account