elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: [1] 2 3 4
1  Programación / Programación General / Re: leer un archivo excel con asp en: 12 Marzo 2012, 16:58 pm
bueno ya que no hubo respuesta de parte de los amigos del foro aca le dejo el codigo funcionando ,por si a  a alguno le interesa


<!--#INCLUDE FILE="Include/Conexion.asp" -->
<html>
<body>
<%
'writeExcelData()
%>
</body>
</html>

<%


   Dim rs,sql,i
   Dim arreglo()
   ReDim arreglo(0,0)

   sql = "SELECT * FROM [hoja1$];"

   if runsql(sql,rs) then
               ROWFON = rs.Fields.Count - 1
 
                redim arreglo (ROWFON+160,ROWFON)
         
                lnRowCounter=0
                Do While Not rs.EOF
             
            
                    For I =1 To ROWFON
                     valor = rs.Fields.Item(I).Value
                         'aca lo lleno
                          arreglo(lnRowCounter,I) = valor
                    'response.write "("&lnRowCounter&","&I&") = " & valor &"|"
                    'response.write  arreglo(lnRowCounter,I)
                         arreglo(I,lnColumnCounter) = valor
               
                 Next
               lnRowCounter=lnRowCounter + 1
               rs.MoveNext
           
            Loop   
   
      end if

   'response.End

'function writeExcelData()

 
           
     'response.write arreglo(3,2) 'año
     'response.write arreglo(5,2) 'rut nombre profesor
    'response.write arreglo(8,2) 'codigo y nombre de la asignatura
    'response.write arreglo(4,2) 'periodo
    'response.write arreglo(11,2)'carrera
     'response.write arreglo(16,3)'codcli
     'response.write arreglo(16,4)'nombre alumno
     'response.write arreglo(14,7)'fecha asistencia
     'response.write arreglo(16,6)'Asistencia
     'Response.Write  "<br>"
     ' response.write arreglo(3,2) 'año
     'response.write arreglo(5,2) 'rut nombre profesor
    'response.write arreglo(8,2) 'codigo y nombre de la asignatura
    'response.write arreglo(4,2) 'periodo
    'response.write arreglo(11,2)'carrera
     'response.write arreglo(17,3)'codcli
     'response.write arreglo(17,4)'nombre alumno
     'response.write arreglo(14,8)'fecha asistencia
     'response.write arreglo(17,6)&"<br>---------"'Asistencia
     
   
             
             
'end if
    'end function  'fin funcion  writeExcelData()
   
   
   
   
     
     
      'function guardar ()
     
'
      'Response.End
   
      if runsql(sql,rs) then
            for  x=6 to ROWFON
            if   arreglo(14,X)<>"" then
           ' Response.Write x&"<br>"
            'Response.Write  arreglo(40,4)
               for  I=16 to   ROWFON+160
             
                     if   arreglo(I,4)<>""   then
                          response.write arreglo(3,2) 'año
                          response.write arreglo(4,2) 'periodo
                          response.write arreglo(5,2) 'rut nombre profesor
                          response.write arreglo(6,2)'segundo profesor
                          response.write arreglo(7,2)'ayudante
                          response.write arreglo(8,2) 'codigo y nombre de la asignatura
                          response.write arreglo(9,2) 'sección
                          response.write arreglo(10,2)'horas
                         
                         response.write arreglo(I,1)'carrera
                         response.write arreglo(I,3)'matricula
                         response.write arreglo(I,4)'nombre alumno
                         response.write arreglo(14,X)'fecha asistencia
                         response.write arreglo(I,x)&"<br>"' asistencia
                        
             sql = "Insert Into ra_asistencia (ano,periodo,docente1,docente2,profayudante,codramo,descripramo,sección,horas,cod_carrera,descripcarrera,matricula,nombre,fecha,asistencia,porcentaje,Fecha_guardadatos)"
            sql = sql & " Values ('"&arreglo(3,2)&"','"&arreglo(4,2)&"','"&arreglo(5,2)&"','"&arreglo(6,2)&"','"&arreglo(7,2)&"','codramo','"&arreglo(8,2)&"','"&arreglo(9,2)&"','"&arreglo(10,2)&"',"
              sql = sql & "'"&arreglo(I,1)&"','descripcarrera','"&arreglo(I,3)&"','"&arreglo(I,4)&"','"&arreglo(14,x)&"','"&arreglo(I,X)&"','0',getdate())"      
             
           Conn.Execute sql
             Response.write sql
             'Response.End             
                   end if 
                      next
                      end if   
                      next
                      end if   
              'end function ' fin funcion guardar

function runSQL(SQL,rs)

   on error resume next

   dim myrs
   dim nombre
   dim ruta
   nombre ="prueba.xls"
    ruta=Server.MapPath(nombre)
 
   set myRs = createobject("ADODB.recordset")
   myRs.Open SQL,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ruta & ";Extended Properties=""Excel 8.0;IMEX=1;""", 1, 3
   set rs = myRs
   if err then
      runSQL = false

      response.write err.description

   else
      runSQL = true
   end if

end function

%>

2  Programación / Programación General / Re: leer un archivo excel con asp en: 7 Marzo 2012, 15:00 pm
Hola estimados e logrado leer los datos pero estoy con un problema aun no puedo meter los  registros en un array bidemencional ,habra alguien que me pueda ayudar gracias este es el codigo


<html>
<body>
<%
writeExcelData()
%>
</body>
</html>

<%

function writeExcelData()

   Dim rs,sql,i
   Dim arreglo()
   ReDim arreglo(0,0)

   sql = "SELECT * FROM [hoja1$];"

   if runsql(sql,rs) then
 
   ROWFON = rs.Fields.Count - 1
 
      redim arreglo (ROWFON,ROWFON)
   
         
              Response.Write "<table border=1><tr>"   
          Do While Not rs.EOF
           Response.Write "<tr>"
              For I = 0 To ROWFON
               valor = rs.Fields.Item(I).Value
               if isnull(valor) = true  then valor= "&nbsp;"
               'Response.Write "<td>" & valor & "</td>"
                                         'aca lo lleno
                      arreglo(lnColumnCounter,I-1) = valor
                     
                      arreglo(I - 1 , lnRowCounter) = valor
                   
                     
                             Response.Write     "<td>" &arreglo(lnColumnCounter, lnRowCounter)& "</td>"
            Next
              Response.Write "</tr>"
              rs.MoveNext
          Loop
              
                
   COL = ubound(arreglo,2)
   FIL = ubound(arreglo,1)

   response.write "COL  ("&COL&")  FIL ("&FIL&")" 
   
   response.write "<table>"
   
For lnRowCounter = 0 To  COL
response.write "</tr>"
   For lnColumnCounter = 0 To FIL
      response.write "</td>"
      Response.Write arreglo(lnColumnCounter, lnRowCounter)
      response.write "</td>"
   Next
   response.write "</tr>"
Next

'Response.Write arreglo(0,0)

   response.write "</table>"
   
   response.end
   
   
      

end function




function runSQL(SQL,rs)

   on error resume next

   dim myrs

   set myRs = createobject("ADODB.recordset")
   myRs.Open SQL,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("prueba.xls") & ";Extended Properties=""Excel 8.0;IMEX=1;""", 1, 3
   set rs = myRs
   if err then
      runSQL = false

      response.write err.description

   else
      runSQL = true
   end if

end function

%>



<br>
<br>
como se lleno ,se llena mostrando la variable valor mas arriba porque ?
<br>
<br>

<%

SentStr = "Four score and seven years ago our fathers brought forth"
ListArray = split(SentStr, " ")

response.write ubound(ListArray)



COL = ubound(arreglo,2)
FIL = ubound(arreglo,1)


For lnRowCounter = 0 To  COL
   For lnColumnCounter = 0 To FIL
      Response.Write arreglo(lnColumnCounter, lnRowCounter)
   Next
Next
%>
3  Programación / Programación General / leer un archivo excel con asp en: 5 Marzo 2012, 20:57 pm
hola Estimados estoy con un problema ,necesito leer un archivo excel  pero no en forma secuencial y no se como hacerlo ,ojala me pudieran ayudar envio el codigo
gracias de antemano
Jorge

<html>
<body>
<%

'Arreglo (0,0)=3
%>

<%

writeExcelData()

%>



</body>
</html>

<%




function writeExcelData()

   Dim rs,sql,i
   Dim arreglo()
   ReDim arreglo(0,0)

   sql = "SELECT * FROM [hoja1$];"

   if runsql(sql,rs) then

   ROWFON = rs.Fields.Count - 1
   
   redim arreglo (ROWFON,5)
   
   columnas = rs.Fields.Count - 1
   
      %>
      <table border="1">
          <thead>
             <tr>
                 <%
               linea1=""
                 For I = 0 To columnas
                  linea1 = rs.Fields.Item(I).Name
                     Response.Write "<th>" &  Linea1 & "</th>"
                  arreglo(columnas,0) = linea1
                 Next
                 %>
              </tr>
          </thead>
          <tbody>
          <%
         contar =0


          Do While Not rs.EOF

              Response.Write "<tr>"

              For I = 0 To columnas
               
               valor = rs.Fields.Item(I).Value
               if isnull(valor) = true  then valor= "&nbsp;"
               Response.Write "<td>" & valor & "</td>"
                 
               contar= contar +1
            Next

              Response.Write "</tr>"

              rs.MoveNext
          Loop
          %>
          </tbody>
      </table>
      <%

      rs.Close

   end if

   Set rs = Nothing

end function




function runSQL(SQL,rs)

   on error resume next

   dim myrs

   set myRs = createobject("ADODB.recordset")
   myRs.Open SQL,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("prueba.xls") & ";Extended Properties=""Excel 8.0;IMEX=1;""", 1, 3
   set rs = myRs
   if err then
      runSQL = false

      response.write err.description

   else
      runSQL = true
   end if

end function

%>



<br>
<br>
como se lleno
<br>
<br>

<%
Response.Write arreglo,2
Response.End
response.write arreglo,2

COL = Ubound(arreglo,2)
FIL = Ubound(arreglo,1)


For lnRowCounter = 0 To  COL
   For lnColumnCounter = 0 To FIL
      Response.Write arreglo(lnColumnCounter, lnRowCounter)
   Next
Next
%> :huh:

este es el archivo
4  Programación / Desarrollo Web / Problemas para abrir o guardar un archivo de power point en el servidor con en: 13 Julio 2010, 21:34 pm
hola Estimados Como estan espero que bien bueno , estoy con un problema resulta que tengo un codigo en asp para  abrir o guardar un archivo de power point  el cual se encuentra en un servidor   al abrirlo me da un arror que no lo encuentra en  los archivos temporales de internet para guardar  pdf ,word no tengo problemas  de antemano muchas gracias  :-\ el codigo es el suiguiente


archivo = Request("nombre")
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile Server.MapPath(archivo)
Response.AddHeader "Content-Disposition", "attachment; filename=" &archivo
Response.ContentType = "application/octet-stream"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
response.write"Descargando archivo"
5  Programación / .NET (C#, VB.NET, ASP) / Re: error Interop.SQLDMO en: 6 Noviembre 2009, 20:07 pm
 no puedo porfque es una aplicacion que me psaron en mi trabajo para instalarla y y notengo los fuentes  lo que se si que la hicieron ccon genexus e  recien le cambie  el framework al 2 poque estab en el 1 en el servidor web  y me arrojo este error

Server Error in '/matricula' Application.
--------------------------------------------------------------------------------

Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: GeneXus.Data.GxADODataException: Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[GxADODataException: Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.Could not load file or assembly 'Interop.SQLDMO, Version=8.0.0.0, Culture=neutral, PublicKeyToken=133555654771caeb' or one of its dependencies. The system cannot find the file specified.]
   GeneXus.Data.ADO.GxCommand.FetchData(IDataReader& dr) +303
   GeneXus.Data.NTier.ADO.ForEachCursor.execute() +174
   GeneXus.Data.NTier.DataStoreProvider.execute(Int32 cursor, Object[] parms) +264
   GeneXus.Programs.haccesosistema.S112() +153
   GeneXus.Programs.haccesosistema.wsia2() +1175
   GeneXus.Programs.haccesosistema.webExecute() +59
   GeneXus.Http.GXHttpHandler.ProcessRequest(HttpContext httpContext) +131

[Exception: GXApplication exception]
   GeneXus.Http.GXHttpHandler.ProcessRequest(HttpContext httpContext) +201
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

 
 :silbar:
6  Programación / .NET (C#, VB.NET, ASP) / error Interop.SQLDMO en: 6 Noviembre 2009, 16:25 pm
hola como estan a todos los del foro bueno estoy con otro problema al instale una aplicaion  en  asp.net y cuando me logeo  me sale este error qeu no se lo que es ojala me puedan ayudar de antemano muchas gracias

File or assembly name Interop.SQLDMO, or one of its dependencies, was not found.File or assembly name Interop.SQLDMO, or one of its dependencies, was not found.  :-X

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: GeneXus.Data.GxADODataException: File or assembly name Interop.SQLDMO, or one of its dependencies, was not found.File or assembly name Interop.SQLDMO, or one of its dependencies, was not found.
7  Programación / .NET (C#, VB.NET, ASP) / Re: como Seleciionar un dato de un DropDownList desde una base de datos en: 5 Noviembre 2009, 20:01 pm
no resulta   aso lo hice


            Dim ver2 As Data.SqlClient.SqlDataReader
            Dim consultar2 As New SqlCommand("SELECT *  FROM DIAS ", conexión)
            ver2 = consultar2.ExecuteReader()
            Me.Dia1.DataSource = ver2
            Me.Dia1.items.add("Seleccione un valor")
            Me.Dia1.DataTextField = "DIAS"
            Me.Dia1.DataValueField = "VALUES"
            Me.Dia1.DataBind()
            ver2.Close()
8  Programación / .NET (C#, VB.NET, ASP) / Re: como Seleciionar un dato de un DropDownList desde una base de datos en: 5 Noviembre 2009, 19:18 pm
si hay funciono muchas gracias 

la otra duda que tengo es como se hace cuando se coloca

en el  DropDownList 

Seleccione un valor para que salga ...

de antemano mucgas gracias
9  Programación / .NET (C#, VB.NET, ASP) / Re: como Seleciionar un dato de un DropDownList desde una base de datos en: 5 Noviembre 2009, 16:57 pm
jeje nop quiero hacer un selected="true"

eso quiero al llenar el  DropDownList   que me compare con una variable ycuando recorra el el DropDownList  y la encuentre me lo deje selecionado  o con el foco

hay se entiende mejor?
 ;-)
10  Programación / .NET (C#, VB.NET, ASP) / Re: como Seleciionar un dato de un DropDownList desde una base de datos en: 5 Noviembre 2009, 16:20 pm
hola gracias por contestar  lleno un DropDownList   desde una tabla  tengo otra tabla con un dato guardado entonces en el formulario cuando lista el el DropDownList necesito que quede selecionado el dato que esta guardado que se supone que esta guardod en la primera tabla tambien
ojal me hallas entendido
Páginas: [1] 2 3 4
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines