
22/05/2009, 13:23
|
 | | | Fecha de Ingreso: enero-2002 Ubicación: Cali - Colombia
Mensajes: 2.234
Antigüedad: 23 años, 3 meses Puntos: 4 | |
Respuesta: leer excel desde asp. aunke ya probe este y le hice bastantes cambios y me funcionaba hasta ayer y ahora me funciona de vez en cuando.. para unos casos y para otros no. entonces nose si sean los formatos de las celdas o no se ke sera..
aun no logro descifrarlo
<%
function lectura(RS)
respuesta = "<TABLE><TR><td> </td>"
For X = 0 To RS.Fields.Count - 1
respuesta = respuesta & "<TD>" & RS.Fields.Item(X).Name & "</TD>"
Next
respuesta = respuesta & "</TR>"
RS.MoveFirst
While Not RS.EOF
respuesta = respuesta & "<TR><td>"&rs.AbsolutePosition&"</td>"
For X = 0 To RS.Fields.Count - 1
respuesta = respuesta & "<TD>" & RS.Fields.Item(X).Value
Next
RS.MoveNext
respuesta = respuesta & "</TR>"
Wend
respuesta = respuesta & "</TABLE>"
lectura=respuesta
end function
strcxn = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=""DBQ=" & server.MapPath("excel_productos.xls") & ";Driver={Microsoft Excel Driver (*.xls)};DriverId=790;FIL=excel 8.0;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5 ;ReadOnly=1;SafeTransactions=0;Threads=3;UID=admin ;UserCommitSync=Yes;"";User Id=admin;"
strclta = "select * from [excel_productos$] "
response.Flush()
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strcxn
Set objRS = Server.CreateObject("ADODB.Recordset")
With objRS
.ActiveConnection = objConn
.CursorType = 3 'Static cursor.
.LockType = 3 'Pessimistic Lock.
.Source = strclta
.Open
end With
response.Write lectura(objrs)
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%> |