Hi my friends,
I want import a file TXT for a table in MySQL, so
try open a file TXT with ODBC, but it don't work with me.
Someone can say because it not work??
what is my mistake?
Please see the attachment
with best regards,
TXT with ODBC
Moderator: Rathinagiri
TXT with ODBC
- Attachments
-
- ImportTX.rar
- (542.24 KiB) Downloaded 234 times
- luisvasquezcl
- Posts: 1258
- Joined: Thu Jul 31, 2008 3:23 am
- Location: Chile
- Contact:
Re: TXT with ODBC
Hi Vanguarda
This function is ok
Function Abrir
LOCAL x := Getfile ( { {'Arquivo Texto','*.TXT'} } , 'Abrir Arquivo' )
LOCAL cConStr := "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\hmg\samples\importTX;Extensions=asc,csv,tab,txt;"
LOCAL oConexao := TODBC():New( cConStr )
LOCAL cFile
cFile = Subs( x, Rat('\',x)+1)
oConexao:SetSQL( "SELECT * FROM "+cfile)
oConexao:Open()
Main.Grid_1.DeleteAllItems
for i= 1 to len( oConexao:aRecordset)
Main.grid_1.additem( {str(oConexao:aRecordset[i,1])} )
next
oConexao:Destroy()
return nil
Regards,
Luis Vasquez
This function is ok
Function Abrir
LOCAL x := Getfile ( { {'Arquivo Texto','*.TXT'} } , 'Abrir Arquivo' )
LOCAL cConStr := "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\hmg\samples\importTX;Extensions=asc,csv,tab,txt;"
LOCAL oConexao := TODBC():New( cConStr )
LOCAL cFile
cFile = Subs( x, Rat('\',x)+1)
oConexao:SetSQL( "SELECT * FROM "+cfile)
oConexao:Open()
Main.Grid_1.DeleteAllItems
for i= 1 to len( oConexao:aRecordset)
Main.grid_1.additem( {str(oConexao:aRecordset[i,1])} )
next
oConexao:Destroy()
return nil
Regards,
Luis Vasquez
Re: TXT with ODBC
Thank friend Luis,
I not have words for thanks... you are very amazing man.
Thanks a lot
with best regards,
I not have words for thanks... you are very amazing man.
Thanks a lot
with best regards,