Ask a Question related to Dreamweaver AppDev, Design and Development.
-
davidc #1
Help with Dreamweaver Insert Statement in SQL
I have a page that is using a dynamic table with the repeatable region that is populated from a query to display items for a customer to return. What I did was created text boxes for the item information and have them dynamically populate from the initial query therefore turning the repeated region into a form that upon submit will write data to a SQL database. the problem i am having is when I apply the insert statement to the region and put it into production i get errors for any submission that has more than one item listed (repeated) in the region. I figured out the reason for this is b/c i beleive i am missing a loop statement with the insert. here is the code i have below. can someone help me get this writing to multiple rows? thanks.
<%
If (CStr(Request("MM_insert")) = "form3") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_returnswizard_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.tbl_dtc_returnswizard (SOPNUMBE, CUSTNMBR, ITEMNMBR, ITEMDESC, QTYORDER, QTYTOINV, LISTPRCE, RMA, MSTRNUMB, REASONRETURN, NOTES, STATUS) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("sopnumbe")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("custnmbr")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("itemnmbr")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, -1, Request.Form("itemdesc")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, -1, Request.Form("qtyorder")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, -1, Request.Form("qtytoinv")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, -1, Request.Form("listprce")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 50, MM_IIF(Request.Form("rma"), "Y", "N")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 50, Request.Form("mstrnumb")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, -1, Request.Form("reasonreturn")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 201, 1, -1, Request.Form("notes")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param12", 202, 1, 50, Request.Form("status")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "returns4.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
Junior Member
- Join Date
- Jun 2011
- Location
- Texas
- Posts
- 1
-
Help with INSERT INTO statement
I'm getting the following error on a query. I haven't seen this one before. Any ideas on what I'm doing wrong? Thanks. Error Executing Database... -
insert statement into a mySQL dB from PHP
I have an insert statement into a mySQL db from PHP 99% of the time the statement executes properly but occasionally no write to the db occurs,... -
INSERT statement contains fewer items than the insert list
The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles... -
Insert 100 rows in just one statement
Your auxiliary table is probably the best way. Populate it with as many rows as you like rather than doing multiple inserts when you need more than... -
Insert Statement help
Hello, I am having some difficulty keeping my data consistent throughout my tables. I have 3 tables that I need to be "synch'd up"....



Reply With Quote

