
Lexus
te paso el archivo completo de lectura de Excel
Código ASP:
Ver original<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
function alea(max)
dim rndmax
dim rndnumber
rndmax = cdbl(max)
randomize timer
rndnumber = int(rnd * rndmax)
alea = rndnumber
end function
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
function insertar(sql,conn)
with conn
.execute(sql)
end with
if Err=0 then
insertar="Perfecto"
else
insertar="Mal, muy mal"
end if
end function
function borrar(sql,conn)
with conn
.execute(sql)
end with
if Err=0 then
borrar="Perfecto<br />"
else
borrar="Mal, muy mal<br />"
end if
end function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<!-- Begin ASP Source Code --><%
'definiciones de uso
strcxn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="&server.MapPath("ADOExcel.xls")&";Extended Properties=Excel 12.0 Xml;"
strclta = "select * from [Hoja1$] order by id_usuario"
strins = "insert into "&_
"[hoja1$](Nombre,Direccion,ID_Usuario,configuracion,elementos,dias)"&_
"values"&_
"('Juliano','cajellon',"&alea(9999)&",'configuracion',"&alea(9999999)&","&alea(10)&");"
strdel = "Delete from [hoja1$] where id_usuario = "&alea(10)&";"
response.Write strcxn & "<br />"
response.Write strins & "<br />"
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
%><br><%
Response.Write("Original Data")
response.Write lectura(objrs)
objRS.Close
Set objRS = Nothing
response.Write insertar(strins,objConn)
response.Write borrar(strdel,objConn)
objConn.Close
Set objConn = Nothing%>
<!-- End ASP Source Code -->
</body>
</html>
:Nota: recuerda que esta utilizando el Office 2007
si quieres volver a intentar verificando las funciones originales con tus cambios

y vuelve a postear los errores que te salgan....