Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update files of Excel in ASP

Status
Not open for further replies.

memo13cr

Technical User
Apr 11, 2005
8
US
I have two files of excel one call "report", and other call "cero", , The next is the code to update the datas of file cero to file report, but only update the first registry, and i want that updates all the registry of the file report.

<%
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

With objConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=C:\inetpub\ & _
"Extended Properties=Excel 8.0;"
.Open
End With

objRS.ActiveConnection = objConn
objRS.CursorType = 3 'Static cursor.
objRS.LockType = 2 'Pessimistic Lock.
objRS.Source = "Select * from A1:M70"
objRS.Open

%>

<%

Set objConnc = Server.CreateObject("ADODB.Connection")
Set rsVa = Server.CreateObject("ADODB.Recordset")

With objConnc
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=C:\inetpub\ & _
"Extended Properties=Excel 8.0;"
.Open
End With

rsVa.ActiveConnection = objConnC
rsVa.CursorType = 3 'Static cursor.
rsVa.LockType = 2 'Pessimistic Lock.
rsVa.Source = "Select * from A1:B70"
rsVa.Open

%>
<% ' Start the update
Dim Item

While Not ObjRs.Eof
Item = ObjRs(6)
while not RsVA.eof
if item = RsVa.Fields(0).Value then
objRS.Fields(6).Value = RsVa.Fields(1).Value
objRS.Update
End if
RsVa.MoveNext

Wend
objRs.MoveNext
Wend


objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

RsVa.Close
Set objRSc = Nothing
objConnc.Close
Set objConnc = Nothing



%>

</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top