Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Visual Basic clásico (http://www.forosdelweb.com/f69/)
-   -   Insertar Por Columnas De Excel (http://www.forosdelweb.com/f69/insertar-por-columnas-excel-556405/)

NEOXL 12/02/2008 16:49

Insertar Por Columnas De Excel
 
BUENAS TARDES ...
ESTOY DESARROLLANDO UN SISTEMA EN VB6 Y PARA ESTO REQUIERO DE INSETAR TODA UNA COLUMNA DE EXCEL A UNA TABLA EN SQL, PARA LUEGO AGREGAR LAS DEMAS COLUMNAS EN SU LUGAR CORRESPONDIENTE, LO QUE SUCEDE ES QUE EN EL EXCEL NO ESTAN TODAS LAS COLUMNAS DE LA TABLA ASI QUE NO PUEDO HACER UN INSERT DIRECTO... GRACIAS POR SUS RESPUESTAS:arriba::arriba:

Avellaneda 13/02/2008 01:18

Re: Insertar Por Columnas De Excel
 
Puedes probar haciendo una conexión al Libro Excel:

Código:

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
With cn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source= " & App.Path & "\Libro1.xls;" & _
            "Extended Properties=Excel 8.0;"
    .CursorLocation = adUseClient
    .Open
End With
cn.Execute "INSERT INTO " & MiTablaSQL & " IN '" & MiBdSQL & "' SELECT * FROM [Hoja1$]"

En la primera fila de la hoja Excel tienes que tener escrito el nombre del campo de la tabla de tu BD.


La zona horaria es GMT -6. Ahora son las 18:53.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.