Solved

ODBC error 80040e10: wrong number of parameters

Posted on 2000-04-13
4
523 Views
Last Modified: 2012-08-13
I am trying to put some data from a web page into a database using an SQL string. Most of the times it works perfectly well, but some users complain that they get an error message as follows:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft] [ODBC Microsoft Access 97 Driver] Wrong number of parameters
/inputpage.asp, line 90

Line 90 contains the line:
 conntemp.open myDSN
where 'myDSN' is defined as follows:
 myDSN="DSN=database"


I searched the web for solutions to this problem, but I only can find pages about a slightly different message with the same code, but the text 'too few parameters' instead of 'wrong number of parameters'. And the solutions I have found there don't seem to count for my problem.

Does anyone have any ideas? Thanks!
0
Comment
Question by:dinx
4 Comments
 

Expert Comment

by:rgroves
ID: 2712430
The error message is coming from your ODBC driver, not necessarily a problem with your ASP code..

Your conntemp might be a recordset object instead of a connection object.

Make sure you declare it as:

set conntemp = Server.CreateObject("ADODB.Connection")
myDSN = "DSN=database"
conntemp.open myDSN
0
 

Expert Comment

by:qualityacube
ID: 2712530
If some values of the web page are not filled and if its assuming to be null then the sQL Statment may be getting a mismatch.

Just print the sql statement before the execute sql statement to see if the fields and input values match.

typically

<%
sqlinsertstring = ...............
%>
Your insert statement.

<%
set conn = Server.CreateObject("ADODB.Connection")
    conn.open "databasename"

or as rgroves mentioned earlier give the dsn name.

as

 conn.open "DSN=databasename;"
%>
<%=insertsqlstring%><%
 conn.execute(insertsqlstring)

Just try it.
Anjana
0
 
LVL 1

Expert Comment

by:jbilsten
ID: 2713124
Okay I've actually gotten this error before so no matter what we'll get this solved.  Here's the way's I worked around it:

First off, in any variables that could be NULL when being entered into the database or could be passed to the SQL string, make sure to declare them as such.  For example:  @name, @address, @city, @state, @zip, @phone = NULL, @accountNumber    etc. etc.

You need to have the variable or input parameter of @phone = to NULL in case the SQL statement is passed a null value.  If it's passed an actual value, don't worry the value will still go into the database.  But if it's NULL then = NULL part will cover it.

Your problem more than not is passing your SQL a NULL value from the form.
0
 

Accepted Solution

by:
mustafa_guney earned 25 total points
ID: 2713174
You must not send string or "" to numeric value
you have to control value of variable
for example
if request.form("a")<>"" then

or
if not isnumeric("a") then
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now