Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/06/2009, 15:06
Avatar de Myakire
Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 23 años, 3 meses
Puntos: 146
Respuesta: ¿ Se puede importar una hoja de excel a una BD por medio de asp ?

No deberías de tener problemas para hacerlo

Aquí un fragmento de código que lo lee, tu solo agrega la parte de grabarlo en la tabla que gustes:
Código ASP:
Ver original
  1. <%
  2.     Dim sSourceXLS
  3.  
  4.     sSourceXLS = Server.MapPath(".") & "\Excel\RollosCosteados.xls"
  5.  
  6.     Dim oConn
  7.     Set oConn = Server.CreateObject("ADODB.Connection")
  8.     oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  9.                "Data Source=" & sSourceXLS & ";" & _
  10.                "Extended Properties=""Excel 8.0;HDR=YES;"""
  11.  
  12.     Dim oRS
  13.     Set oRS = Server.CreateObject("ADODB.Recordset")
  14.     oRS.Open "Select * from [Rollos$A1:Y1000]", oConn, 1, 3
  15.    
  16.         %>
  17.         <table width="100%" border="1">
  18.         <%
  19.     Do While Not (oRS.EOF)
  20.         %><tr><%
  21.         For i = 0 To 24
  22.                     %><td><%=oRS.Fields(i).Value%><%
  23.         Next
  24.         oRS.MoveNext
  25.     Loop
  26.         %>
  27.         </table>
  28.         <%
  29.    
  30.     oRS.Close
  31.     Set oRS = Nothing
  32.    
  33.     'Close the connection to the workbook
  34.     oConn.Close
  35.     Set oConn = Nothing
  36. %>