Renoir,
TEXT TO < variable > was introduced in VFP7. As you can see it's vary handy in building of connection string or SQL statements. In VFP6 or eirlier you'll have to build connection string some other way.
>Thanks Sergey! It's good to need to be around...
>
>I haven't gotten the help files for VFP loaded yet (server access issue), but the TEXT TO doesn't seem to set any values to anything. When I get to the lnConnHand = line it bombs as lcConnStr has no value. I'm just trying to go from an Excel sheet to a standalone DBF. Sorry about the formatting, but it's been so long I can't recall the codes show code snips properly.
>
>Renoir
>
>lcExcelFile = GETFILE()
>
>TEXT TO lcConnStr TEXTMERGE NOSHOW
>DRIVER=Microsoft Excel Driver (*.xls);
>FIL=excel 8.0;
>DefaultDir=<<JUSTPATH(lcExcelFile)>>;
>DBQ=<<lcExcelFile>>;
>ENDTEXT
>
>lnConnHand = SQLSTRINGCONNECT(lcConnStr)
>IF lnConnHand > 0
> STORE SQLTABLES(lnConnHand, 'TABLE', 'tExcelFile') TO nTables
> IF nTables > 0
> SELECT tExcelFile
> lcSheet=ALLTRIM(tExcelFile.Table_Name)
> lnSqlRes = SQLEXEC(lnConnHand, [SELECT * FROM "]+lcSheet+["],'tImport')
> ENDIF
> ln=SQLDISCONNECT(lnConnHand)
> USE IN tExcelFile
> USE IN tImport
>ENDIF
>
>>Nice to see you around. :)
>>You can use ODBC as shown in
Re: Append from (cFileName) xl8 -- Truncation Thread #
743344 Message #
745579.
--sb--