If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > update access table via asp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-05-04, 15:20
matthersjr matthersjr is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
update access table via asp

I encounter the following error when I try to update a record in a table.

Error:
Microsoft JET Database Engine error '80040e10'
Too few parameters. Expected 12.
uprocess.asp, line 144

The error points to: .Execute , , adExecuteNoRecords
on the update.asp file.

I use a dbinclude along with my update.asp page. Also, below is my stored query.


------------
dbinclude.asp

Dim strDBType, strSource, oConn, sConnect, oCmd, mySQL, myRS
strDBType = "Access"

strSource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strLevel & "db/test.mdb")

Public Function adoConnectJet40(strSource, psFilePassword)
' returns Jet 4.0 ADO connect string:
' "Provider=Microsoft.Jet.OLEDB.4.0
' ;Data Source=DriveLetter:\pathtodb\dbname.mdb
' ;Jet OLEDBatabase Password=whateveritmaybe"
Dim sProvider, sDataSource, sDBPassword
sProvider = "Provider=Microsoft.Jet.OLEDB.4.0"
sDataSource = ";Data Source=" & strSource
If psFilePassword = "" Then
sDBPassword = ""
Else
sDBPassword = ";Jet OLEDBatabase Password=" & psFilePassword
End If
adoConnectJet40 = sProvider & sDataSource & sDBPassword
End Function
'constants for updates
Const adCmdStoredProc = 4
Const adVarChar = 200
Const adLongVarWChar = 203
Const adInteger = 3
Const adDouble = 5
Const adParamInput = 1
Const adExecuteNoRecords = 128
sConnect = adoConnectJet40(strSource, "")
'shared db info for stored queries
set oConn=Server.CreateObject("ADODB.connection")
oConn.open strSource

----------------------------
update.asp

strhv_EventID = Request.Form("hv_EventID")
strChapterID = Request.Form("ChapterID")
strChapterEventName = Request.Form("ChapterEventName")
Dim lCEN
lCEN = Len(strChapterEventName)
strEventBeginMonth = Request.Form("selectEventBeginMonth")
strEventBeginDate = Request.Form("selectEventBeginDate")
strEventBeginYear = Request.Form("selectEventBeginYear")
strEventBeginD = strEventBeginMonth & "/" & strEventBeginDate & "/" & strEventBeginYear
strEventEndMonth = Request.Form("selectEventEndMonth")
strEventEndDate = Request.Form("selectEventEndDate")
strEventEndYear = Request.Form("selectEventEndYear")
strEventEndD = strEventEndMonth & "/" & strEventEndDate & "/" & strEventEndYear
strEventBeginTime = Request.Form("selectEventBeginTime")
strEventBeginSetting = Request.Form("selectEventBeginSetting")
strEventBeginT = strEventBeginTime & " " & strEventBeginSetting
strEventEndTime = Request.Form("selectEventEndTime")
strEventEndSetting = Request.Form("selectEventEndSetting")
strEventEndT = strEventEndTime & " " & strEventEndSetting
strChapterEventLocation = Request.Form("ChapterEventLocation")
Dim lCEL
lCEL = Len(strChapterEventLocation)
strChapterEventTopicSpeaker = Request.Form("ChapterEventTopicSpeaker")
Dim lCETS
lCETS = Len(strChapterEventTopicSpeaker)
strChapterEventContent = Request.Form("ChapterEventContent")
Dim lCEC
lCEC = Len(strChapterEventContent)

'db stored query update
if oConn.State = 1 then
Response.Write("connection OK <br />")
set oCmd = Server.CreateObject("ADODB.Command")
with oCmd
.CommandText = "qryEventUpdateProc"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("@strChapterID", adInteger, adParamInput, 4, strChapterID)
.Parameters.Append .CreateParameter("@strChapterEventName", adLongVarWChar, adParamInput, lCEN, strChapterEventName)
.Parameters.Append .CreateParameter("@strEventBeginD", adVarChar, adParamInput, 50, strEventBeginD )
.Parameters.Append .CreateParameter("@strEventEndD", adVarChar, adParamInput, 50, strEventEndD )
.Parameters.Append .CreateParameter("@strEventBeginT", adVarChar, adParamInput, 50, strEventBeginT )
.Parameters.Append .CreateParameter("@strEventEndT", adVarChar, adParamInput, 50, strEventEndT )
.Parameters.Append .CreateParameter("@strChapterEventLocation", adLongVarWChar, adParamInput, lCEL, strChapterEventLocation )
.Parameters.Append .CreateParameter("@strChapterEventTopicSpeaker", adLongVarWChar, adParamInput, lCETS, strChapterEventTopicSpeaker )
.Parameters.Append .CreateParameter("@strChapterEventContent", adLongVarWChar, adParamInput, lCEC, strChapterEventContent )
.Parameters.Append .CreateParameter("@strhv_EventID", adInteger, adParamInput, 4, strhv_EventID )
Set .ActiveConnection = oConn
.Execute , , adExecuteNoRecords
end with
Set oCmd = nothing
'set oConn = nothing
End if
--------------------------

stored query in access 2000

PARAMETERS [@strChapterID] Short, [@strChapterEventName] Text ( 255 ), [@strEventBeginD] Text ( 255 ), [@strEventEndD] Text ( 255 ), [@strEventBeginT] Text ( 255 ), [@strEventEndT] Text ( 255 ), [@strChapterEventLocation] Text ( 255 ), [@strChapterEventTopicSpeaker] Text ( 255 ), [@strChapterEventContent] Text ( 255 ), [@strhv_EventID] Short;
UPDATE tblChapterEvents SET tblChapterEvents.ChapterID = [@strChapterID], tblChapterEvents.ChapterEventName = [@strChapterEventName], tblChapterEvents.EventBeginD = [@strEventBeginD], tblChapterEvents.EventBeginT = [@strEventBeginT], tblChapterEvents.EventEndT = [@strEventEndT], tblChapterEvents.ChapterEventLocation = [@strChapterEventLocation], tblChapterEvents.ChapterEventTopicSpeaker = [@strChapterEventTopicSpeaker], tblChapterEvents.ChapterEventContent = [@strChapterEventContent]
WHERE (((tblChapterEvents.EventID)=[@strhv_EventID]));
-------------------------------------


Any ideas?
Reply With Quote
  #2 (permalink)  
Old 03-06-04, 00:06
matthersjr matthersjr is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
spelling error on my part; corrected it and works fine
Reply With Quote
  #3 (permalink)  
Old 03-08-04, 01:40
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Thanks for letting us know the answer as that was a lot of code there!
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On