Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP to ACCESS
Message
De
30/04/2008 09:10:35
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01314154
Message ID:
01314159
Vues:
22
This message has been marked as the solution to the initial question of the thread.
Hi Julie.

>I have the code below which opens an access database and a FoxPro table. I want to populate the access table from the fox data. When I execute the INSERT statement foxpro popups a box asking me for the accounts table.

The INSERT command is for VFP tables and cursors only.

Why not use ODBC rather than Automation? It would make the code a little simpler. For example:
lnHandle = sqlstringconnect('Driver=Microsoft Access Driver (*.mdb);' + ;
   'dbq=H:\Source Code\Access Test\db1.mdb')
if lnHandle < 1
* didn't connect, so use AERROR() to find out why
   return
endif
USE table1  &&& Fox Table with same stucture
scan
   cAccid=table1.accid
   cAccountnum=table1.accountnum
   cAccountNam=table1.accountnam
   cPswd=table1.pswd
   lnResult = sqlexec(lnHandle, 'INSERT INTO accounts ' + ;
      '(accid, accountnum, accountnam, pswd)' + ;
      'VALUES (?cAccid, ?cAccountnum, ?cAccountNam, ?cPswd)')
   if lnResult < 1
* failed to update, so use AERROR() to find out why
   endif
endscan
use
sqldisconnect(lnHandle)
Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform