Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPOLEDB, Update and Delete statements?
Message
De
27/10/2003 03:42:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
26/10/2003 20:33:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00842248
Message ID:
00842824
Vues:
38
Same. Include the fullpath to the free table. You might use any dbc as the datasource (ie: testdata.dbc).
Cetin

>Thank you Cetin,
>
>I now understand how the execute method enables us to send SELECT statements and commands, such as UPDATE, to the the datastore via ADO. Thank you for the example. Could you please suggest a scheme, and some code of course, for sending commands to a fpw26 free table, acting as a datatstore, in an **ado.net** set up.
>
>Regards,
>Neil
>
>>>Hi,
>>>
>>>Can someone please give me an example of how I could DELETE and UPDATE a record in a vfp table while I am connected to the table via VFPOLEDB? Please use tastrade dbc as an example please.
>>>
>>>
>>>Regards,
>>>Neil
>>
>>Hi Neil,
>>This is a way :
>>
>>
>>Local oConn as adodb.connection, ;
>>	oRS as ADOdb.Recordset, ;
>>	lcCOnnStr as String
>>oConn = CreateObject('Adodb.connection')
>>lcConnStr = 'Provider=VFPOLEDB.1;Data source='+;
>>  Sys(5)+Curdir()+'testdata.dbc'
>>With oConn
>>  .Open(lcConnStr)
>>
>>  oRS = .Execute('select * from customer')
>>  ShowMe('Customer table', oRS)
>>
>>  .Execute('set deleted on')
>>  .Execute('delete from customer where cust_id = "B"')
>>  oRS = .Execute('select * from customer')
>>  ShowMe('Customer table - After Deleted(ansi on,default)', oRS)
>>
>>  .Execute('set ansi off')
>>  .Execute('delete from customer where cust_id = "B"')
>>  oRS = .Execute('select * from customer')
>>  ShowMe('Customer table - After Deleted(ansi off)', oRS)
>>
>>  .Execute('update customer set maxordamt = maxordamt + 1000')
>>  oRS = .Execute('select * from customer')
>>  ShowMe('Customer table - After update', oRS)
>>
>>  .Execute('update customer set maxordamt = maxordamt - 1000') && restore
>>  oRS = .Execute('select * from customer')
>>  ShowMe('Customer table - After restore', oRS)
>>
>>  .Close
>>endwith
>>
>>
>>
>>Function ShowMe
>>Lparameters tcCaption,toRecordset
>>oForm = Createobject('myForm', tcCaption,toRecordset)
>>oForm.Show
>>Read Events
>>Endfunc
>>
>>Define Class myform As Form
>>  Height = 450
>>  Width = 750
>>  Name = "Form1"
>>
>>  Add Object hflex As OleControl With ;
>>    Top = 10, Left = 10, Height = 430, Width = 730, Name = "Hflex", ;
>>    OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'
>>
>>  Procedure Init
>>  Lparameters tcCaption,toRecordset
>>  This.Caption = tcCaption
>>  This.hflex.Datasource = toRecordset
>>Endproc
>>  Procedure QueryUnload
>>  Clear Events
>>Endproc
>>Enddefine
>>
>>PS: Didn't use tastrade but testdata. Tastrade not only have triggers that'd fail for a simple sampling worse it has trigger code that's assuming it's always running from within tastrade.app.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform