Bulk editing

  • Thread starter Thomas J. Brooks, Jr.
  • Start date
T

Thomas J. Brooks, Jr.

Hi there...

I have an ASP page which retrieve all records from a database and displays
in a table in a form. The database has 5 fields and 3 records total. So I
do the following:

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DSN=myDSN"
q1="SELECT * FROM [mydata]"
Set RecSet1 = oConn.Execute(q1)

So it displays in a 5 column x 3 row table, with code as follows:

<table>
<tr>
<td>heading1</td>
<td>heading2</td>
<td>heading3</td>
<td>heading4</td>
<td>heading5</td>
</tr>
<%Do While Not RecSet1.eof%>
<tr>
<td><input type=text id=f1 name=f1 value="<%=RecSet1(0)">
<td><input type=text id=f2 name=f2 value="<%=RecSet1(1)">
<td><input type=text id=f3 name=f3 value="<%=RecSet1(2)">
<td><input type=text id=f4 name=f4 value="<%=RecSet1(3)">
<td><input type=text id=f5 name=f5 value="<%=RecSet1(4)">
<%RecSet1.movenext
Loop
RecSet1.close
oConn.Close
%>
</td>
</tr>
</table>

What I'd like to do is to create a bulk editing routine. Because I have the
database contents in text fields, I'd like to be able to edit those values
as necessary and do a bulk UPDATE query, saving all records with any changes
that I've made.

Is this even possible and if so, how would I do it? Would I need to update
one record at a time in the same manner as I populated the table rows?

Thanks

Tom
 
M

MGFoster

Thomas said:
Hi there...

I have an ASP page which retrieve all records from a database and displays
in a table in a form. The database has 5 fields and 3 records total. So I
do the following:

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DSN=myDSN"
q1="SELECT * FROM [mydata]"
Set RecSet1 = oConn.Execute(q1)

So it displays in a 5 column x 3 row table, with code as follows:

<table>
<tr>
<td>heading1</td>
<td>heading2</td>
<td>heading3</td>
<td>heading4</td>
<td>heading5</td>
</tr>
<%Do While Not RecSet1.eof%>
<tr>
<td><input type=text id=f1 name=f1 value="<%=RecSet1(0)">
<td><input type=text id=f2 name=f2 value="<%=RecSet1(1)">
<td><input type=text id=f3 name=f3 value="<%=RecSet1(2)">
<td><input type=text id=f4 name=f4 value="<%=RecSet1(3)">
<td><input type=text id=f5 name=f5 value="<%=RecSet1(4)">
<%RecSet1.movenext
Loop
RecSet1.close
oConn.Close
%>
</td>
</tr>
</table>

What I'd like to do is to create a bulk editing routine. Because I have the
database contents in text fields, I'd like to be able to edit those values
as necessary and do a bulk UPDATE query, saving all records with any changes
that I've made.

Is this even possible and if so, how would I do it? Would I need to update
one record at a time in the same manner as I populated the table rows?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Read the ADO articles on UpdateBatch.

First find out if the recordset supports batch updating:

If RecSet1.Supports(adUpdateBatch)=True Then
' ... do stuff ...

' then update the batch
RecSet1.UpdateBatch

... etc.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQtwP54echKqOuFEgEQJmWgCeIXNA3QhPFjCcHnvonxZPgL1w1nwAnjW8
8RFCGRcqbKjSyvNNrlezReLt
=yiRQ
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top