Forums

This topic is locked

DW Update Record Error in SQL

Posted 31 Jul 2007 00:22:16
1
has voted
31 Jul 2007 00:22:16 Tom Bathgate posted:
Hi All,

Can anyone help me. I'm using DW update record behaviour to update a record. There is a link that use go to detail page and passes the record id. The form then displays the correct information but when you click submit it goes wrong and i get:
[Microsoft][ODBC SQL Server Driver][SQL Server]Prepared statement '(@P1 text,@P2 text,@P3 text,@P4 text,@P5 text,@P6 float,@P7 text' expects parameter @P13, which was not supplied.

I can't find anything on this and its driving me round the bend.

Can anyone help/

The code for the update is:
<pre id=code><font face=courier size=2 id=code>
Set MM_editCmd = Server.CreateObject ("ADODB.Command"
MM_editCmd.ActiveConnection = MM_cbd_conn_STRING
MM_editCmd.CommandText = "UPDATE dbo.Companies SET ContactName = ?, CompanyName = ?, Address1 = ?, Address2 = ?, Adress3 = ?, CityID = ?, PostCode = ?, County = ?, Telephone = ?, Email = ?, Website = ?, AreasCovered = ?, userPass = ?, agreeTerm = ?, subscribe = ? WHERE DEAID = ?"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 50, Request.Form("contactName") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 50, Request.Form("companyName") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 50, Request.Form("Address1") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, 50, Request.Form("address2") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 50, Request.Form("address3") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1, MM_IIF(Request.Form("townCity", Request.Form("townCity", null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, 50, Request.Form("postCode") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 201, 1, 50, Request.Form("County") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201, 1, 20, Request.Form("phoneNumber") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, 100, Request.Form("emailAddress") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 201, 1, 200, Request.Form("webSite") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 201, 1, 4000, Request.Form("areasCovered") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 201, 1, 32, Request.Form("userPass") ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param14", 5, 1, -1, MM_IIF(Request.Form("terms", -1, 0)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param15", 5, 1, -1, MM_IIF(Request.Form("mailingList", 1, 0)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param16", 5, 1, -1, MM_IIF(Request.Form("MM_recordId", Request.Form("MM_recordId", null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
</font id=code></pre id=code>

Thanks in advance

Tom

Edited by - tbathgate on 31 Jul 2007 02:11:36

Replies

Replied 02 Aug 2007 11:54:03
02 Aug 2007 11:54:03 Georgi Kralev replied:
Hi Tom,

It seem that you have not passed a value for one of your parameters.
I believe that this parameter is param13.

Check if Request.Form("userPass" in the following line return the required value:

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param13", 201, 1, 32, Request.Form("userPass") ' adLongVarChar

I hope this will help you.

Regards,

Georgi Kralev

----------------------------------
Support - www.DMXzone.com

Reply to this topic