Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why is TableUpdate() failing?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00273914
Message ID:
00274006
Vues:
32
>>Just for grins.. try the INSERT SQL statement instead of APPEND BLANK and see what happens.
>>WT
>
>Without even trying I'd be willing to bet it will work. There were reasons I was not using the INSERT SQL, but I've forgotten them now. I'll post them when I remember...

OK, I remember now. I may be comlpetely misunderstanding the whole concept, but this is how I see it right now.

Note that I have no views/tables in my DE, I use a SQL SELECT in my form.load() to create the cursor. I have also set transactions = 2.

If I APPEND BLANK to insert a record, this is the flow:
1.)APPEND BLANK
2.)modify fields of new record
3.)TABLEUPDATE() && Update the cursor, gives the new record a real RECNO instead of -1
4.)SQLExec(INSERT SQL..) && Inserts the new record, along with modified fields to the SQL DB
5.)SQLCommit() && Commits the changes to the SQL DB.

(looking back at the process it seems the tableupdate and sqlcommit are redundant, as are the append blank and SQLexec(INSERT..), conceptually. My thinking was that if I kept the data in the cursor up to date with the tableupdates, I wouldn't have to requery the table every time I added a record.)

If I use SQL INSERT to add a record, this is the flow:
1.)SQLExec(INSERT...) &&Insert the new blank record
2.)SQLExec(SELECT...) && Requery to update the cursor --> This is what I was trying to stay away from, as requerying a table with 20,000 records takes too long.
3.)LOCATE the new record
4.)modify fields of new record
5.)SQLExec(UPDATE...) && Save the modified record
6.)SQLCommit()

I think I'm way off here...would you be willing to let me know what the order of events *should* be?

Thanks for your time!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform