Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Whats wrong with this Update statement?
Message
From
04/01/2003 18:38:52
 
 
To
04/01/2003 18:04:32
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00738082
Message ID:
00738086
Views:
17
>Hi all:
>
>The following is an update statement in the save button. It gives no error messages, but the table is not updated.
>
>
update clinic set clinic.grop_num = int(mgrop_num)), ;
>	clinic.clnc_name = mclnc_name, ;
>	clinic.address2 = maddress2, ;
>	clinic.address22 = maddrss_22 ,;
>	clinic.city = mcity, ;
>	clinic.province = mprovince, ;
>	clinic.postalcode = mpostalcode, ;
>	clinic.area_phone = marea_phone,;
>	clinic.phone = mphone, ;
>	clinic.area_fax = marea_fax ,;
>	clinic.facsimile = mfacsimile, ;
>	clinic.Gender = mDefaultGender;
>	where recno() = 1
>
>Where am I going wrong? TIA.

In general the use of RECNO() in SQL commands is unreliable; VFP may open other instances of your table(s) in unexpected order(s). If you look closely at your table you may actually find that a record other than the one you want is getting updated.

Instead, each table should have a primary key and you should update based on that key:
update clinic set clinic.grop_num = int(mgrop_num)), ;
	clinic.clnc_name = mclnc_name, ;
	clinic.address2 = maddress2, ;
	clinic.address22 = maddrss_22 ,;
	clinic.city = mcity, ;
	clinic.province = mprovince, ;
	clinic.postalcode = mpostalcode, ;
	clinic.area_phone = marea_phone,;
	clinic.phone = mphone, ;
	clinic.area_fax = marea_fax ,;
	clinic.facsimile = mfacsimile, ;
	clinic.Gender = mDefaultGender;
	where PrimaryKeyField = PrimaryKeyValue
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform