navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Updating multiple records at once

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Updating multiple records at once
Page: [1]
 
AllenD

 

Posts: 258
From: Dayton, OH, USA
Status: offline

 
Updating multiple records at once - 3/30/2001 16:22:00   
Hello, I have a script that I wrote to update multiple records at once (I know it is not recommended, but I really need to have it this way for convience of the users). The problem I am having is that it will update the first record, but not the 2nd, it appears everything is correct in the code, but it is not working correctly. When I pull the ID of the record into the 2nd field I have it named argid, but have told the code that argid = id when updating. Here is the multi-part code:

<%
user=request.querystring("user")
'Declare variables needed
Dim strSQL
Dim adCmdText

'Set required variables
adCmdText = 1

'***********************************************************
'* Step 1: Display a list of boat class names to select from
'***********************************************************
If Len(Request.Form("FormAction")) = 0 Then

'Create the recordset object
Set objRS = Server.CreateObject("ADODB.Recordset")

'Open the recordset getting a list of all boat classes
objRS.Open "Select Distinct wedate from everyone'","DSN=offstats"
'Response.write objRS("user") & "<BR>"
%>
<form action=Ex.asp method=post name=frmDisplay>
<input type=hidden name=FormAction value=Step2>
<table>
<tr>
<td colspan=2>Select a we date to update</td>
</tr>
<tr>
<td>WE Date</td>
<td><select name=cbowedate>
<%
'Loop through the recordset adding class name to the combo box
Do While Not objRS.EOF
%>
<option value="<%=objRS("wedate")%>">
<%=objRS("wedate")%></option>
<%
objRS.MoveNext

Loop

'Close and dereference database objects
objRS.Close
Set objRS = Nothing
%>
</select>EDSNET ID <input NAME="user" VALUE="<%=Request.ServerVariables("REMOTE_USER")%>" size="20"></td>
</tr>
<tr>
<td height=60><input type=submit name=btnSubmit value=Submit></td>
</tr>
</table>
</form>

<%
'***********************************************************
'* Step 2: Display the update form
'***********************************************************
ElseIf Request.Form("FormAction") = "Step2" Then

'Build the SQL string
strSQL = "Select * from Everyone where wedate = '" & _

CStr(Request.Form("cbowedate")) & "'"

'Create the recordset object
Set objRS = Server.CreateObject("ADODB.Recordset")

'Open the recordset getting the boat class details
objRS.Open strSQL,"DSN=offstats"
%>

<form action=update2.asp method=post name=frmUpdate>
<%
'Loop through the recordset adding class name to the combo box
'Do While Not objRS.EOF
%>


<input type=hidden name=txtClassName
value="<%=objRS("Account")%>"><input type=hidden name=FormAction value=Step3>
<p>
ID    <input type="text" name="ID" size="20" value="<%=objRS("id")%>">
</p>
<p>
Account <input type=text name=account size=30
value=<%=objRS("account")%>>
</p>
<p>
EDSNET <input NAME="edsnet" VALUE="<%=Request.ServerVariables("REMOTE_USER")%>" size="20">
</p>
<table height="334">
<tr>
<td nowrap height="21">Allison Cust</td>
<td height="21"><input type="text" name="aecust" size="20" value="<%=objRS("cust")%>"></td>
</tr>
<tr>
<td nowrap height="25">Allison SN</td>
<td height="25"><input type=text name=aesn size=5
value=<%=objRS("sn")%>></td>
</tr>
<tr>
<td nowrap height="25">SA</td>
<td height="25"><input type=text name=aesa size=5
value=<%=objRS("sa")%>></td>
</tr>
<tr>
<td nowrap height="25">SE</td>
<td height="25"><input type=text name=aese size=5
value=<%=objRS("se")%>></td>
</tr>
<tr>
<td nowrap height="25">Misc</td>
<td height="25"><input type=text name=aemisc size=5
value=<%=objRS("misc")%>></td>
</tr>
<tr>
<td height="25">Undisp</td>
<td height="25"><input type=text name=aeundisp size=30
value=<%=objRS("undisp")%>></td>
</tr>
<tr>
<td height="21">Report</td>
<td height="21"><input type=text name=aereport size=30
value=<%=objRS("report")%>></td>
</tr>
<tr>
<td height="21">FYI</td>
<td height="21"><input type=text name=aefyi size=30
value=<%=objRS("fyi")%>></td>

</tr>
</table>
<%

objRS.MoveNext

'Loop

'Close and dereference database objects
'objRS.Close
'Set objRS = Nothing
'End If
%>

ID <input type="text" name="argid" size="20" value="<%=objRS("id")%>">
<p>Account <input type=text name=argaccount size=30
value=<%=objRS("account")%>>

</p>
<p>ARG Cust <input type="text" name="argcust" size="20" value="<%=objRS("cust")%>">
</p>
<p>ARG SN <input type="text" name="argsn" size="20" value="<%=objRS("sn")%>">
</p>
<p><input type="submit" value="Submit" name="Submit">

<br>

<% End If %>
</p>
</form>
---------------------------
Here is the error message I am getting:

Record is now updated!

Your update is shown below
UPDATE Everyone SET account='Allison',edsnet='VMCWEB\rzm41v',cust='111',sn='221',sa='331',se='441',misc='551',undisp='661',report='771',fyi='881' WHERE ID=516Database Errors Occured

UPDATE Everyone SET argcust='201',argsn='191' WHERE ID=517

Error #-2147217904

Error desc. -> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
------------------
Any help is apprecited! Thanks!

Guest


 
RE: Updating multiple records at once - 3/31/2001 22:44:00   
Is your database, in design view, set to allow zero length?

It may be expecting more inputs that you have supplied


(in reply to AllenD)
AllenD

 

Posts: 258
From: Dayton, OH, USA
Status: offline

 
RE: Updating multiple records at once - 4/2/2001 20:47:00   
yes, all fields are set to allow zero length, like I said, it works for the first record, just not the 2nd...Spooky, any ideas?

(in reply to AllenD)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Updating multiple records at once - 4/2/2001 20:02:00   
I dont see any updates being performed in there at all? What script does that?

(in reply to AllenD)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Updating multiple records at once
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts