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>
<%
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>