Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update table with grid and cursor
Message
 
 
À
16/04/2002 07:55:34
Khurram Khan
Filtrona Pvt Ltd.
Karachi, Pakistan
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00645360
Message ID:
00645413
Vues:
11
Hi!

Select * from order where order_id=123 into cursor kk NOFILTER
USE (DBF("kk")) AGAIN ALIAS MyResultSet IN 0
USE IN kk
Thisform.Grid1.RecordSource="MyResultSet"

Anyway, it is better to use views, because changes you make in the temporary cursor will not be updated to the table automatically.

Create a view named "kk" with the query like "Select * from order where order_id=?param_order_id". Define the updating key (record id) and updatable fields, check "Send SQL Updates" checkbox and save the view.
Then your code for grid will look like following:

param_order_id = 123
USE kk IN 0
Thisform.Grid1.RecordSource = "kk"

The changes by user will be saved automatically to table when view is closed or tableupdate() command used or record pointer change.

To refresh the grid by another list using another order id, you will need just do following:

param_order_id = 321
requery("kk")
Thisform.Grid1.Refresh


Hope this helps.

>To All My dears,
>
>I want that I retrieve records, change and again save in table.
>
>Select * from order where order_id=123 into cursro kk
>Thisform.Grid1.RecordSource="kk"
>but the Control of Grid is ReadOnly
>now How I change the Record and again save in table.
>
>I m trying to last month on this website but I have no proper reply.
>
>thanks
>Khurram
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform