Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2005
    Posts
    8

    Unanswered: Error Message: Too Few Parameters. Expected 1.

    Hi, can anyone see where i have gone wrong in this SQL. I continue to get the error message below.

    SELECT SupplierName, Location, ShortDescription
    FROM Query1
    WHERE TimberSpecies LIKE '%MMColParam%' AND CategoryTable LIKE '%MMColParam2%' AND Location LIKE '%MMColParam3%'

    MMColParam 1 Request.Form("keywordSearch")
    MMColParam 2 Request.Form("CategoryTable")
    MMColParam 3 Request.Form("Location")

    When I test this SQL in the recordset i get the following error message.

    [Microsoft][ODBC Microsoft Access Driver] Too Few Parameters. Expected 1.

    ??

    Mally.

  2. #2
    Join Date
    Nov 2004
    Posts
    374

    sql

    LIKE '%MMColParam%' A
    as the string is protected by quotes, I don't think it is seen as a variable
    but the query is looking for columns containing this string MMColParam
    Best Regards, Guy Przytula
    DB2/ORA/SQL Services
    DB2 DBA & Advanced DBA Certified
    DB2 Dprop Certified
    http://users.skynet.be/przytula/dbss.html

  3. #3
    Join Date
    Dec 2005
    Posts
    8

    Sql

    Thanks for that. I changed the files. No more error message but now I dont get any results in the search.

    My SQL reads:

    SELECT SupplierName, Location, ShortDescription
    FROM Query1
    WHERE 'TimberSpecies' LIKE MMColParam AND 'CategoryTable' LIKE MMColParam2 AND 'Location' LIKE MMColParam3

    MMColParam 1 Request.Form("keywordSearch")
    MMColParam2 2 Request.Form("location")
    MMColParam3 3 Request.Form("category")

    Mally

  4. #4
    Join Date
    Nov 2004
    Posts
    374

    sql

    maybe if you change MMColParam 1 Request.Form("keywordSearch")
    to add % in front and at end, otherwise you search for specific string and not containing string
    Best Regards, Guy Przytula
    DB2/ORA/SQL Services
    DB2 DBA & Advanced DBA Certified
    DB2 Dprop Certified
    http://users.skynet.be/przytula/dbss.html

  5. #5
    Join Date
    Dec 2005
    Posts
    8

    Sql

    If this is what you mean, I get an error message 'Invalid Veriable'.

    %MMColParam% 1 Request.Form("keywordSearch")

    Mally
    Last edited by malhyp; 12-10-05 at 09:53.

  6. #6
    Join Date
    Nov 2004
    Posts
    374

    sql

    no ; I meant to add % to the value of the variable
    eg : if Request.Form( "keywordSearch") = aaaa
    to have %aaa% in this variable, so the like would search for any record containing this string in the column value
    Best Regards, Guy Przytula
    DB2/ORA/SQL Services
    DB2 DBA & Advanced DBA Certified
    DB2 Dprop Certified
    http://users.skynet.be/przytula/dbss.html

Posting Permissions

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