TXT with ODBC

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

TXT with ODBC

Post by Vanguarda »

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,
Attachments
ImportTX.rar
(542.24 KiB) Downloaded 234 times
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: TXT with ODBC

Post by luisvasquezcl »

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
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: TXT with ODBC

Post by Vanguarda »

Thank friend Luis,

I not have words for thanks... you are very amazing man.

Thanks a lot


with best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
Post Reply