Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import Type XLS
Message
De
30/06/2004 10:30:53
 
 
À
29/06/2004 17:14:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00918700
Message ID:
00919027
Vues:
22
Hi,
I a bit surprised why nobody use ODBC connection to Excel file. Its so easy, and on my opinion its the best way to get result.
And!.. As you wish, the ODBC driver read fieldname from first row, and data begin from second row.
lcConnectionString = "DBQ="+lcExcelFilename+";DefaultDir="+JUSTPATH(lcExcelFilename)+";Driver={Microsoft Excel Driver (*.xls)};DriverId=790;FIL=excel 8.0;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;ReadOnly=1;SafeTransactions=0"

lnHCon = Sqlstringconnect(lcConnectionString)
IF lnHCon>0 && some code skipped
lnSQLTable = SQLTABLES(lnHCon, "'TABLE', 'VIEW', 'SYSTEM TABLE'", '__sqltables')
* Some code skipped again
lcSheet = __sqltables.table_name
lcExec = "SELECT * FROM ["+lcSheet+"]"
lcResultALias = "__mycursor"
lnExecResult = SQLEXEC(lnHCon,lcExec,lcResultAlias)
SQLDISCONNECT(lnHCon)
It might looks a bit complex .. but one time you create own class to read and work with excel files and I sure, you will never use IMPORT anymore...



>Is there a way to programatically import on excel file and tell it the the first name contains field names and begin import on row 2?? You can do it with the wizard but I do not see anything in the import to documentation that helps. I may be going blind as well :)
>
>TIA
>
>Paul
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform