![]() |
|
![]() | ||
|
Subject:
Undating several records on one page
Category: Computers > Programming Asked by: wellsuited-ga List Price: $20.00 |
Posted:
06 Nov 2002 13:17 PST
Expires: 06 Dec 2002 13:17 PST Question ID: 100620 |
I have a page on my website where I need to be able to update all records in the table at the same time. I need the code for the processing page to do this, and form page if any. Table name: adminusers Field names: ID username password Here is the form page. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="Connections/Invoiveppab.asp" --> <% Dim Recordset1 Dim Recordset1_numRows Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = MM_Invoiveppab_STRING Recordset1.Source = "SELECT * FROM adminusers" Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() Recordset1_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = 10 Repeat1__index = 0 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form name="form1" method="post" action=""> <% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %> <table width="100%" border="0"> <tr> <td width="11%">Username:</td> <td width="89%"> <input name="textfield" type="text" value="<%=(Recordset1.Fields.Item("username").Value)%>"> <input name="ID" type="hidden" id="ID" value="<%=(Recordset1.Fields.Item("ID").Value)%>"></td> </tr> <tr> <td>Password:</td> <td> <input name="textfield2" type="text" value="<%=(Recordset1.Fields.Item("password").Value)%>"></td> </tr> <tr> <td> </td> <td> <input type="submit" name="Submit" value="Submit"></td> </tr> </table> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Recordset1.MoveNext() Wend %> </form> <p> </p> </body> </html> <% Recordset1.Close() Set Recordset1 = Nothing %> | |
| |
| |
| |
|
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: Undating several records on one page
From: bardentech-ga on 06 Nov 2002 19:51 PST |
Easiest way to do it is like this: Build your display page with a loop: <% For i = 0 to rs.fields.count -1 %> ...<TR><TD>...</TD></TR> <% next %> When you build the table, name each textbox the name of the field in the database: <%=rs.fields(i).name%> Put the value from your recordset in the box: <%=rs.fields(i).value%> Now pass the form to the processing page and open the recordset for editing by the unique key you have setup. Run through a loop and get all the values from the form using the for each method: Dim item for each item in request.form rs.fields(item.name) = item.value <--- not 100% sure of the syntax here but you get the point do you get what I'm saying here? I can pull some code for you in you need it. I did this a couple months ago for online property value website. We pulled all the values for a property and a person would update square footage or whatever and we would put that new information in the database. John |
Subject:
Re: Undating several records on one page
From: mathtalk-ga on 08 Nov 2002 08:48 PST |
Hi, wellsuited-ga: I'm not sure what you are using on your Web server, but a general (MS) topic that pertains to this is "disconnected recordsets" in ADO, although these originated I believe with desktop apps and need a bit of support on the Web server (IIS) to work in a browser. Disconnected recordsets allow for selective updating of just those records which have been changed by the client without requiring extensive custom case logic. Here's a Microsoft article on doing it: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k2/html/ODC_DisRecordset.asp but given its generally poor rating by readers (1.4 out of 5), you will probably want to look at some of the other 400+ sites returned by my search: Keywords: "disconnected recordset" ADO Vbscript ://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=%22disconnected+recordset%22+ADO+Vbscript&btnG=Google+Search I especially like the explanatory tone of this one: http://www.asp-help.com/database/db_ado_rs.asp regards, mathtalk-ga |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |