473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with Access query in ASP Error Too few parameters. Expected 1.

33
Hi,

I am using ADODB connection in ASP and want to run a select query depending on a runtime criteria.
But its not working and giving error "Too few parameters. Expected 1." But the same thing is working when pasted in Access query. The problem comes when including a LIKE criteria.
can anybody help me ??

Matsam
Jun 29 '07 #1
6 2435
danp129
323 Expert 256MB
In the very least you should provide the line of code that is giving the error and if it's failing on a query, an output of the query (response.write strSQL).
Jun 29 '07 #2
Matsam
33
Hi,
thx for responding. i m sorry tht i left out the query.

it is as follows

PublTitle = trim(Request.Form.Item("txtTitle"))
sqlQuery = "Select Authors, Year, PaperTitle, Source, Volume, Number, PageNo from Bibliography where [SlNo] > 0 "

cond = " and [PaperTitle] like ""*" & PublTitle & "*"""
sqlQuery = sqlQuery & cond

the response.write returns the following

Select Authors, Year, PaperTitle, Source, Volume, Number, PageNo from Bibliography where [SlNo] > 0 and [PaperTitle] like "*the*"

the same query works when pasted to access..

it works in ASP ony if condition is avioded.

pls help me

matsam
Jun 29 '07 #3
danp129
323 Expert 256MB
Did you include the line it's failing on?
Jun 29 '07 #4
Matsam
33
It fails on the open line of the select query.

rs.Open sqlQuery, cn1, adOpenStatic

Problem comes when <and [PaperTitle] like "*the*" > is added. Otherwise it works fine.
I think it is not working for any string expressions. Numerics are ok.

Error is :
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


matsam
Jun 30 '07 #5
danp129
323 Expert 256MB
It fails on the open line of the select query.

rs.Open sqlQuery, cn1, adOpenStatic

Problem comes when <and [PaperTitle] like "*the*" > is added. Otherwise it works fine.
I think it is not working for any string expressions. Numerics are ok.

Error is :
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


matsam
It may be expecting you to specify a locktype like:

rs.Open sqlQuery, cn1, adOpenStatic, adLockOptomistic

Also, when written out to the page the SQL should be looking like this
[PaperTitle] like '*the*' < note the single qoutes instead of double.

You may also want to use % instead of * cause I think * only works as a wildcard within Access but I could be mistaken.
Jun 30 '07 #6
Matsam
33
It may be expecting you to specify a locktype like:

rs.Open sqlQuery, cn1, adOpenStatic, adLockOptomistic

Also, when written out to the page the SQL should be looking like this
[PaperTitle] like '*the*' < note the single qoutes instead of double.

You may also want to use % instead of * cause I think * only works as a wildcard within Access but I could be mistaken.
Hi,

Many many thanks to you..
My problem solved. As u said, it was bcoz of the double quotation instead of single. I also changed * to %. Now it worked. I was trying the same in Access query too, but it was working fine. And when I replaced * with % in Access, it was not working. Thatz why i didnt tried it in ASP code..
Any way, I wasted my 3 days for this simple thing..

Once again thanks a lot

Matsam
Jun 30 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: kbrad | last post by:
I am using the following code in asp to select some data from an access db. recSel is defined and set further up my webpage, as is rsUpdate User. I cannot work out how to get past this error...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
3
by: Richard Morton | last post by:
Hi, This is my first posting to this list, I guess a small intro should be first, been developing in PHP for sometime, mainly with Mysql and nearly always on Windows (oops, sorry). I have...
7
by: Max | last post by:
I know this is not an Access group, but there doesn't seem to be one, and I'm guessing MS SQLs are all quite similar - at least in relatively simple cases like this one. I'm using this SQL...
10
by: MLH | last post by:
Gentlemen: I am having one heck of a time taking a DAO walk through the records in an SQL dynaset. I'm trying to walk a set of records returned by a UNION query. I'm attempting to filter the...
4
by: Gilberto | last post by:
Hello, I have a couple of forms using the code to FIND AS YOU TYPE from Allen Browne (http://allenbrowne.com/AppFindAsUType.html). It worked PERFECTLY until yesterday when i splitted the db into...
9
by: QCLee | last post by:
Sir can you help me to transfer my Access Query to MS excel? i have a command button on the form to export the parameter query named "HVACWindwardQuery" to excel spreadsheet and i got the codes...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.