FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
Guardar un DBGrid como archivo *.dbf
Hola, envio un enorme saludo a todos los participantes del foro.
El motivo del hilo es el siguiente, estoy haciendo un conversor de archivos de xls a dbf, ya conseguí recuperar el archivo xls ( de Excel ) a un DBGrid, pero el problema que tengo es como voy a guardarlo como un archivo con extension .dbf, mi objetivo final es que este archivo pueda ser abierto por una aplicación de Fox. Y por tanto es necesario que la estructura del archivo sea la adecuada. Espero puedan ayudarme GRACIAS XD |
#2
|
||||
|
||||
No se si has utilizado ADO para abrir el fichero de Excel en el DBGrid (si no lo has hecho míratelo o busca en la ayuda, porque es una buena forma de hacerlo). De la misma forma puedes utilizar también ADO pra grabar o conectar a tablas DBF.
Así que lo más sencillo sería tener dos conexiones ADO, una con la cadena de conexión a Excel, similar a esta: Código:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"; Código:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password=;
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#3
|
|||
|
|||
Una pregunta mas
Muchas gracias por responder, una pregunta mas .............
Cómo podría crear una nueva tabla .dbf utilizando la conexion ADO ???? Y como podría migrar los datos de xls a la tabla recien creada ??? GRX. |
#4
|
||||
|
||||
Puedes crear la tabla utilizando una SQL. Si configuras la conexión tal y como te he comentado antes, una SQL como esta te creará la tabla en el directorio configurado en la conexión:
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#5
|
|||
|
|||
Datos que voy a obtener de Excel
Otra pregunta mas porfavor
Mmmm me imagine que era mas complicado . Estuve toda la madrugad con eso. Necesito hacer una consulta a los datos que tengo de excel y que ya estan cargados en un ADODataSet, la consulta la hacía de la siguiente manera: Código:
cadena:='select * from c:\base\ACTUA.xls'; // Esta linea esta bien ???? ADOQuery1.Active:=False; ADOQuery1.SQL.Text :=cadena; ADOQuery1.Active := True; Luego de hacer esa consulta, pensaba ya insertarlo en el archivo dbf. pero no funciona Última edición por richisaurio fecha: 18-06-2008 a las 11:37:52. |
#6
|
||||
|
||||
Cita:
La consulta es de la siguiente manera:
Donde [Hoja1$] es el identificador de la hoja dentro del libro cuyos datos deseas consultar. Recuerda que el libro lo configuraste en la conexión, por lo tanto la consulta es sobre las hojas. Saludos.
__________________
Conoce mi blog http://www.edgartec.com |
#7
|
|||
|
|||
Codigo para crear estructuras DBF
Aqui tienes un codigo para crear tu mismo las estructuras de tus archivos dbf, mediante un pequeno trozo de codigo que encontre un dia en la web...
Saludos desde Concepcion-Chile
|
#8
|
||||
|
||||
vaya ese si es un buen aporte.
__________________
Conoce mi blog http://www.edgartec.com |
#9
|
||||
|
||||
Crear Tablas .dbf
Se que ya tiene tiempo este hilo pero podrian explicar un poco el funcionamiento del codigo, es decir se pega en un .pas y se agrega al proyecto o se pone dentro del codigo de nuestra aplicacion y se manda llamar con las funciones ahi expuestas o como es que esa unit se agrega al delphi, tengo mas o menos una idea pero igual y ayudaria a otros a poder utilizar el codigo y ami por supuesto
__________________
En movimiento... |
#10
|
||||
|
||||
al ver la estructura, diria yo que es un .pas , lo que tendrias q hacer es copiar el codigo en por ejemplo notepad, guardar como .pas y luego añadirla a tu proyecto desde delphi. recien ahi puedes usarla desde cualquier form con solo agregar "MakeDBF " al uses .
|
#11
|
||||
|
||||
Con el mismo Office podes guardar tu xls en formato dbf.
Saludos. |
#12
|
||||
|
||||
Excelente corre de lujo, funciona bien como comentaste, mas o menos tenia la idea jeje en fin ya quedo mas claro gracias juanplata, y tambien a cloayza por encontrar este excelente codigo +10 jaja ( ah no aqui no funciona asi)...
__________________
En movimiento... |
#13
|
||||
|
||||
De casualidad alguien tiene, algun ejemplo de como se una MAkeDBF ????
|
#14
|
|||
|
|||
Te recopio parte de la unidad de mi post anterior, aquí esta la forma de uso.
Saludos cordiales |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Guardar Archivo de Texto como en Excel | BlueSteel | Varios | 4 | 26-09-2007 17:11:38 |
Como guardar un TChart en archivo gif? | crespopg | Gráficos | 1 | 04-05-2007 23:18:26 |
Como Guardar Impresión en Archivo .QRP de QReport???? | AGAG4 | Impresión | 5 | 29-11-2005 02:46:24 |
Como guardar un objeto en un archivo ? | cmurua71 | OOP | 7 | 18-11-2005 21:26:30 |
guardar un dbgrid en un archivo de texto | unreal4u | Conexión con bases de datos | 4 | 18-03-2005 20:08:57 |
|