Foros del Web » Programando para Internet » ASP Clásico »

problema con excel en asp

Estas en el tema de problema con excel en asp en el foro de ASP Clásico en Foros del Web. hola amigos toy tratando de pasar los datos de una consulta sql a una hoja excel y me manda el siguiente error: Cita: Tipo de ...
  #1 (permalink)  
Antiguo 28/03/2006, 09:37
Avatar de mc_quake  
Fecha de Ingreso: enero-2006
Ubicación: www.ecocargo.cl
Mensajes: 683
Antigüedad: 19 años, 3 meses
Puntos: 8
problema con excel en asp

hola amigos toy tratando de pasar los datos de una consulta sql a una hoja excel

y me manda el siguiente error:

Cita:
Tipo de error:
Error de Microsoft VBScript en tiempo de ejecución (0x800A0046)
Permiso denegado
/PRUEBAS/Muestra/EXCEL/consultarec.asp, línea 28
este es el codigo que uso la linea en rojo es el error

Cita:
' Name of the access db being queried
Set cn = Server.CreateObject ("ADODB.Connection")
cn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=state_info.mdb;"

Set rs = Server.CreateObject ("ADODB.RecordSet")

' Query the states table from the state_info db
sql = "select state,statename,capital,year,order from states "

' Execute the sql
rs.Open sql, cn

' Move to the first record
rs.MoveFirst

' Name for the ouput document
file_being_created= "states.xls"

' create a file system object
set fso = createobject("scripting.filesystemobject")

' create the text file - true will overwrite any previous files
' Writes the db output to a .xls file in the same directory
Set act = fso.CreateTextFile(server.mappath(file_being_creat ed), true)

' All non repetitive html on top goes here
act.WriteLine("<html><body>")
act.WriteLine("<table border=""1"">")
act.WriteLine("<tr>")
act.WriteLine("<th nowrap>State</th>")
act.WriteLine("<th nowrap>Abbreviaton</th>")
act.WriteLine("<th nowrap>Capital</th>")
act.WriteLine("<th nowrap>Year Entered</th>")
act.WriteLine("<th nowrap>Entrance Number</th>")
act.WriteLine("</tr>")

' For net loop to create seven word documents from the record set
' change this to "do while not rs.eof" to output all the records
' and the corresponsding next should be changed to loop also

for documents= 1 to 7

Act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">" & rs("statename") & "</td>" )
act.WriteLine("<td align=""right"">" & rs("state") & "</td>" )
act.WriteLine("<td align=""right"">" & rs("capital") & "</td>")
act.WriteLine("<td align=""right"">"& rs("year") & "</td>")
act.WriteLine("<td align=""right"">"& rs("order") & "</td>")
act.WriteLine("</tr>")

' move to the next record
rs.movenext

' return to the top of the for - next loop
' change this to "loop" to output all the records
' and the corresponsding for statement above should be changed also
next

' All non repetitive html on top goes here
act.WriteLine("</table></body></html>")


' close the object (excel)
act.close


' Writes a link to the newly created excel in the browser
response.write "<a href='states.xls'>States</a> (.xls) has been created on " & now() & "<br>"

%>
si alguien me pudiera ayudar se le agradecera
__________________
Mc_Quake

Para ayudar en lo que se pueda:Zzz:
  #2 (permalink)  
Antiguo 28/03/2006, 10:30
 
Fecha de Ingreso: noviembre-2005
Mensajes: 658
Antigüedad: 19 años, 6 meses
Puntos: 3
Te falta dar permiso de Control Total al usuario anonimo que es el IUSR_nombremaquina en la carpeta en donde se generará la planilla excel.
Para hacer eso vas con el explorador de windows hasta la carpeta y das click derecho y en la carpeta Seguridad agregas el usuario IUSR..... o bien el grupo al cual pertenece; que dependiendo del Sistema Operativo puede ser el Everyone o bien el grupo Invitados; una vez ingresado el usuario o grupo das click en el y vas a la parte inferior en donde aparecen los permisos y ahi marcas Control Total... eso es todo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:55.