473,725 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

33 New Member
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 2459
danp129
323 Recognized Expert Contributor
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 New Member
Hi,
thx for responding. i m sorry tht i left out the query.

it is as follows

PublTitle = trim(Request.Fo rm.Item("txtTit le"))
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 Recognized Expert Contributor
Did you include the line it's failing on?
Jun 29 '07 #4
Matsam
33 New Member
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 Recognized Expert Contributor
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, adLockOptomisti c

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 New Member
It may be expecting you to specify a locktype like:

rs.Open sqlQuery, cn1, adOpenStatic, adLockOptomisti c

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
1922
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 message Too few parameters. Expected 1. Can anyone see the problem? strSQL = "SELECT tblUserDetails.UserRecId, tblUserDetails.UserName, " _ & "tblUserDetails.UserPw, tblUserDetails.UserEmailAddress, " _ & "tblUserDetails.UserFirstName,...
13
4228
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 solution here - until now. This one is driving me crazy. I am making my first attempt at creating a runtime application. I am using Access 2003 Developer Extensions. Initially I developed the database without planning on creating a runtime app...
1
2888
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 correctly. 3078" after I migrated "MS Access 2000" to "MS SQL Server 2000" and relinked all linked tables. The front-end interface of my application is MS Access 2000. The back-end is MS SQL Server 2000. After I migrated the database and
0
3937
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. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
3
1612
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 done some bizarre things with PHP, but now I am involved in re-writing an application (from ASP.NET). The database however I can't change so easily as there are other
7
1927
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 statement, "SELECT .IDNUMBER, .SURNAME, .NAMES, Misc.PHONE_NUMBER, Misc.VOTE FROM LEFT JOIN Misc ON .IDNUMBER = Misc.IDNUMBER
10
3739
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 records to those related to vehicle #60 ( = 60 ). If I explicitly specify 60 in the SQL ==everything works fine. Take a look: 100 PString = "SELECT & " & Chr$(&H22) & Space(1) & Chr$(&H22) & " & AS Recipient " 120 PString = PString & "FROM...
4
2555
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 FE/BE. The tables link ok and everything works ok EXCEPT this function. When i open the form it gives me a underlining line (iReturn = ctl.Parent.PageIndex IN THE PARENTNUMBER function in BOLD) and indicating that iReturn=0. I am new with access and...
9
2778
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 from searching on the internet and books but the problem is when i run the command button "Export" it just only open the Blank Spreadsheet, no data at all that it came from my query named "HVACWindwardQuery" and there's an error on it...
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.