Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Saving of record won't work
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Saving of record won't work
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01496386
Message ID:
01496386
Vues:
109
I am using a buffered table and then TableUpdate() to save it. What is weird is that from all appearances and stepping through the code, the NEW record seems to be saved. However, after closing the form and re-opening the form, the newly saved record is always gone. What have I missed? Oh, also, I am using a View to present the data from two tables and saving only the data from one table on the form. I also checked the box in the Local View that says "Send SQL Updates", and then put checkmarks on the fields I wanted to be updateable.

I can see that any changes I make to any existing record do take; they are saved, but NEW appended records are not saved.

Setup code in LOAD event:
USE (.cTable) IN 0 EXCLUSIVE	&& Opens both ORDERS and Customers tables.
SELECT (.cTable)	&& LV_ORDERS
* Create indexes for Local View, LV_ORDERS.
INDEX ON Lic_Plate TAG Lic_Plate
INDEX ON ALLTRIM(LASTNAME)+ALLTRIM(FIRSTNAME) TAG LFNAME
INDEX ON VIN TAG VIN
INDEX ON ORDER_NO TAG ORDER_NO
SET ORDER TO LFNAME

* Set the buffering to Optimistic buffering.
SET MULTILOCKS ON
CURSORSETPROP("Buffering", 5, "lv_Orders")	&& Changes are only made to the ORDERS table.
* Open other tables, which are used for DropDown Lists.
USE States IN 0 SHARED
USE Warranty IN 0 ORDER Warranty SHARED
The precise code in my SaveIt() function is:
LPARAMETERS tcTable
LOCAL llGoodSave

WITH ThisForm
	llGoodSave = TABLEUPDATE(0,.T., tcTable)
	IF !llGoodSave
		WAIT WINDOW NOWAIT "Was not able to save changes."
	ELSE
		.newButton.Enabled = .T.	&& Turn New button back on now that data has been saved.
		*.cmdLetter.Enabled = .T.	&& Turn Letter button back on,...
		.printButton.Enabled = .T.	&& Turn Print button back on,...
		.saveButton.Enabled = .F.		
		.cancelButton.Enabled = .F.
		WAIT WINDOW NOWAIT "Save was successful!"
	ENDIF
ENDWITH
RETURN llGoodSave
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform