Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ODBC error 80040e10: wrong number of parameters

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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