Solved

ODBC error 80040e10: wrong number of parameters

Posted on 2000-04-13
4
518 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

20 Experts available now in Live!

Get 1:1 Help Now