If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error Message: Too Few Parameters. Expected 1.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-10-05, 04:04
malhyp malhyp is offline
Registered User
 
Join Date: Dec 2005
Posts: 8
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.
Reply With Quote
  #2 (permalink)  
Old 12-10-05, 04:50
przytula przytula is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 12-10-05, 05:18
malhyp malhyp is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 12-10-05, 08:29
przytula przytula is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 12-10-05, 08:47
malhyp malhyp is offline
Registered User
 
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 08:53.
Reply With Quote
  #6 (permalink)  
Old 12-11-05, 03:39
przytula przytula is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On