|
 |
asp_databases thread: Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
Message #1 by Leo Clayton <claytonl@z...> on Mon, 18 Dec 2000 16:27:26 -0500
|
|
--=====================_568673389==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
I'm trying to update a TABLE using the command object and am receiving the
following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 5.
/EmployeeMasterStuff/UpdateEmployeeTable3.asp, line 55
This is line 55:
objComm.Execute
I am checking a form to see if any of these five fields have anything in
them. If so, I move the form field to a variable; if not, I move what's
already in the table field to the variable. Then I build my SQL statement
and attempt to execute it.
Here is my code:
<!--#include file="adovbs.inc"-->
<!--#include file="DataStore.inc"-->
<% Response.Buffer = True %>
<html>
<head>
<title>UPDATING FIELD(S) IN THE EMPLOYEE TABLE</title>
</head>
<body>
<%
Dim objRS, objComm, finalSQL
Dim updatefirstname, updatelastname, updatetitle, updateeducation,
updatejobhistory
Dim IsDataMissing
dim sSQL
Set objComm = Server.CreateObject("ADODB.Command")
objComm.ActiveConnection = strConnect
if not Request.Form("FirstName") = "" Then
updatefirstname = Request.Form("Firstname")
else
updatefirstname = FirstName
End If
if not Request.Form("LastName") = "" Then
updatelastname = Request.Form("Lastname")
else
updatelastname = LastName
End If
if not Request.Form("Title") = "" Then
updatetitle = Request.Form("Title")
else
updatetitle = Title
End If
If not Request.Form("Education") = "" Then
updateeducation = Request.Form("Education")
else
updateeducation = Education
End If
If not Request.Form("JobHistory") = "" Then
updatejobhistory = Request.Form("JobHistory")
else
updatejobhistory = JobHistory
End If
sSQL = "UPDATE EmployeeTable SET
FirstName=updatefirstname,LastName=updatelastname,Title=updatetitle,Educatio
n=updateeducation,JobHistory=updatejobhistory WHERE (IDNumber =
'"&Session("IDNumber")&"')"
objComm.CommandText = sSQL
objComm.CommandType = adCmdText
'objComm.Execute (sSQL)
objComm.Execute
Response.Write "<HR><BR>The UPDATE command has been executed, "
Response.Write "<BR>"
Response.Write "<B><U>YOU HAVE JUST UPDATED</U> "
Response.Write (Request.Form("Firstname"))
Response.Write " "
Response.Write (Request.Form("Lastname"))
Response.Write "<U>IN THE EMPLOYEE TABLE.</U></B> "
Set objComm = Nothing
%>
---<BR>
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS<BR>
IN YOUR INBOX!<BR>
Get the latest and best HTML, XML, and JavaScript tips, tools, and <BR>
developments from the experts. Sign up for one or more of EarthWeb's<BR>
FREE IT newsletters at http://www.earthweb.com today! <BR>
---<BR>
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')<BR>
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com<BR>
</BODY>
</html>
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 19 Dec 2000 11:00:31 +1100
|
|
Leo,
Do this:
Response.Write(sSQL)
and you will see exactly why you are having problems. You are not
concantenating string literals and variables when you build your SQL
string...
Cheers
Ken
----- Original Message -----
From: "Leo Clayton" <claytonl@z...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, December 19, 2000 5:28 PM
Subject: [asp_databases] Microsoft OLE DB Provider for ODBC Drivers error
'80040e10'
> --=====================_568673389==_.ALT
> Content-Type: text/plain; charset="us-ascii"; format=flowed
>
> I'm trying to update a TABLE using the command object and am receiving the
> following error:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
>
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 5.
>
> /EmployeeMasterStuff/UpdateEmployeeTable3.asp, line 55
>
> This is line 55:
> objComm.Execute
<snip>
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #3 by "Dallas Martin" <dmartin@z...> on Mon, 18 Dec 2000 20:26:44 -0500
|
|
Your ACCESS query is expecting 5 parameters
You need to add them to your command object:
Here's the syntax:
' create command object
Set CMD = Server.CreateObject("ADODB.Command")
'** FOR EACH PARAMETER
Set oParam = CMD.CreateParameter
oParam.Name = "parameter1"
oParam.Type = adTypeInteger 'enum types given in ADOVBS.INC
oParam.Direction = adParameterDirectionInput ' input as oppose to output
oParam.Value = 1000 ' or string, or date or whatever
' add to CMD object
CMD.Parameters.Add oParam
DONT FORGET THE CONNECTION string
hth,
Dallas Martin
----- Original Message -----
From: "Leo Clayton" <claytonl@z...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, December 19, 2000 1:28 AM
Subject: [asp_databases] Microsoft OLE DB Provider for ODBC Drivers error
'80040e10'
> I'm trying to update a TABLE using the command object and am receiving the
> following error:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
>
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 5.
>
> /EmployeeMasterStuff/UpdateEmployeeTable3.asp, line 55
>
> This is line 55:
> objComm.Execute
>
> I am checking a form to see if any of these five fields have anything in
> them. If so, I move the form field to a variable; if not, I move what's
> already in the table field to the variable. Then I build my SQL statement
> and attempt to execute it.
>
> Here is my code:
> <!--#include file="adovbs.inc"-->
> <!--#include file="DataStore.inc"-->
>
> <% Response.Buffer = True %>
>
> <html>
> <head>
> <title>UPDATING FIELD(S) IN THE EMPLOYEE TABLE</title>
> </head>
> <body>
>
>
> <%
> Dim objRS, objComm, finalSQL
> Dim updatefirstname, updatelastname, updatetitle, updateeducation,
> updatejobhistory
> Dim IsDataMissing
> dim sSQL
> Set objComm = Server.CreateObject("ADODB.Command")
> objComm.ActiveConnection = strConnect
>
> if not Request.Form("FirstName") = "" Then
> updatefirstname = Request.Form("Firstname")
> else
> updatefirstname = FirstName
> End If
>
> if not Request.Form("LastName") = "" Then
> updatelastname = Request.Form("Lastname")
> else
> updatelastname = LastName
> End If
>
> if not Request.Form("Title") = "" Then
> updatetitle = Request.Form("Title")
> else
> updatetitle = Title
> End If
>
> If not Request.Form("Education") = "" Then
> updateeducation = Request.Form("Education")
> else
> updateeducation = Education
> End If
>
> If not Request.Form("JobHistory") = "" Then
> updatejobhistory = Request.Form("JobHistory")
> else
> updatejobhistory = JobHistory
> End If
>
> sSQL = "UPDATE EmployeeTable SET
>
FirstName=updatefirstname,LastName=updatelastname,Title=updatetitle,Educatio
> n=updateeducation,JobHistory=updatejobhistory WHERE (IDNumber
> '"&Session("IDNumber")&"')"
> objComm.CommandText = sSQL
> objComm.CommandType = adCmdText
> 'objComm.Execute (sSQL)
> objComm.Execute
> Response.Write "<HR><BR>The UPDATE command has been executed, "
> Response.Write "<BR>"
> Response.Write "<B><U>YOU HAVE JUST UPDATED</U> "
> Response.Write (Request.Form("Firstname"))
> Response.Write " "
> Response.Write (Request.Form("Lastname"))
> Response.Write "<U>IN THE EMPLOYEE TABLE.</U></B> "
> Set objComm = Nothing
>
> %>
> </BODY>
> </html>
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |