Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor adapter with text files
Message
From
23/07/2007 04:57:24
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01242234
Message ID:
01242694
Views:
15
Thank you,

your sample works. However I couldn't make it updatable... :(

>Sample code below shows how to access a text file through ODBC/CursorAdapter
>
>lcFolder = "H:\TEMP\sdffiles"
>lcSdfFile = "tempsdf.txt"
>lcSchemaFile = "schema.ini"
>
>* Create test SDF file
>TEXT TO lcStr NOSHOW
>AAAAA00005555BBBBBB
>CCCCC00003556CCCCCC
>QREWW00432445GFDGDF
>ENDTEXT
>STRTOFILE(lcStr, lcFolder + "\" + lcSdfFile)
>
>* Create Column definition for the ODBC driver
>TEXT TO lcStr TEXTMERGE NOSHOW
>[<<lcSdfFile>>]
>ColNameHeader = False
>Format = FixedLength
>MaxScanRows=0
>CharacterSet=OEM
>Col1 = FLD01 char width 5
>Col2 = FLD02 char width 8
>Col3 = FLD03 char width 6
>ENDTEXT
>
>STRTOFILE(lcStr, lcFolder + "\" + lcSchemaFile)
>
>lcConnStr = "DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=" + lcFolder + ";"
>lnConn = SQLSTRINGCONNECT(lcConnStr)
>IF lnConn  < 0
>	* Error
>	=AERROR(laError)	
>	?  ALLTRIM( laError[1,2] )
>	RETURN
>ENDIF	
>
>oCA = CREATEOBJECT("CursorAdapter")
>oCA.DataSourceType = "ODBC"
>oCA.DataSource = lnConn
>oCA.SelectCmd = "SELECT * FROM " + lcSdfFile
>oCA.Alias = "crsSdfText"
>oCA.CursorFill()
>BROWSE
>
>
>See mskb #146220 and mskb #155512 for more info about Text ODBC driver.
>
>>
>>I need access a text file with cursor adapter class. I tried connection strings which I found from web but not success... :(
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform