Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERTING into SQL server table from VFP Cursor
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00985368
Message ID:
00985454
Vues:
39
>Hi,
>
>I have a VFP cursor "invtotals"
>I want to INSERT the entire cursor "invtotals" into SQL Server 2000 table "u_Holds".
>
>If I were updating VFP tables I could use something like the following
>Insert into u_Holds (u_cpono,u_cinvno)
>values (Select po,inv FROM invtotals WHERE choldbo='BO')
>
>How do I do this using the SQLEXEC command ?
>
>Thanks in advance
>Carmel

Try this, It works for me for 1 record, but not tested if You are inserting many.
cSql = SQLEXEC(sqlH,"SELECT u_cpono,u_cinvno FROM u_Holds WHERE 1=0","MyTempCrs")
IF cSql > 0
   SELECT MyTempCrs
   CursorSetProp('KeyFieldList','u_cpono,u_cinvno'   ,'MyTempCrs')
   CursorSetProp('WhereType'   ,          2,'MyTempCrs')
   CursorSetProp('Tables'      ,  'u_Holds','MyTempCrs')
   CursorSetProp("UpdateNameList", ;
                 "u_cpono    MyTempCrs.u_cpono,"+;
                 "u_cinvno   MyTempCrs.u_cinvno",'MyTempCrs')
   CursorSetProp('UpdatableFieldList','u_cpono, u_cinvno','MyTempCrs')
   CursorSetProp('SendUpdates',.T.,'MyTempCrs')
   CursorSetProp('Buffering',    5,'MyTempCrs')
   INSERT INTO MyTempCrs (u_cpono, u_cinvno) VALUES;
              (Select po,inv FROM invtotals WHERE choldbo='BO')
   Tableupdate(1,.T.,'MyTempCrs')
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform