Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Negative number on table update
Message
From
14/07/2017 02:31:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
13/07/2017 21:03:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01652622
Message ID:
01652654
Views:
52
>Thanks Tamar et al.
>
>Okay. Here's what I'm doing:
>
>I have a local view that is being used to capture business data (i.e. name, ein, city, state zip etc). After the user inputs the data, presses the save button, the code does some validation (i.e. not empty, checks valid EIN prefix etc). Upon clean validation, the code then does an Insert (field 1, 2 , 3 etc) values (thisform.text1.value, thisform.text2.value etc etc). There is a primary key associate with this view (pk_comp_id). But I am having that field populated with a procedure called oPro.GetNewRec. This is nothing more than the NewId stored procedure that is commonly used in the default value of the table field name. I just decided to make it a class and pass the table name to it: oVar.NewRecId = oPro.GetNewRec('lv_company_view')
>
>Then i goto the local view, locate teh record that was just created and simply attempt, to do a Replace pk_comp_id with oVar.NewRecId. Then i do my tableupdate, and grins...I have a brows as the next line to see which fields were populated clean. All the fields were poplated clean EXCEPT the pk_comp_id. The tableupdate is returning a -1 and .T. all the time, every time.
>
>Any ideas to what is going on from anyone...this has been kicking my butt all week...

Just a kick at the can... I've noticed that sometimes doing an insert, tableupdate, then some other stuff (which may move the record pointer), then go back to the record, replace a field or two, tableupdate() - the 2nd tableupdate returns .t. but does nothing. I changed my code to just omit the first tableupdate and now it works. I guess there's some glitch in the getfldstate() it may be using internally... Didn't investigate, just found what works.

Try to set the PK in the insert itself. IOW, instead of doing insert-tableupdate-replace pk-tableupdate, do just insert-tableupdate in one go.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform