Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updateable view Not Updating...have Send SQL Updates checked.... 3

Status
Not open for further replies.

ahaws

Programmer
Nov 28, 2001
355
US
Good Afternoon-
Having a problem I have never encountered:

I have txtboxes that control source to an updateable view.

When the user is finished editing - I execute this code:

If Messagebox("Save Changes to Lienholder Information?",4+32+128,"Please Confirm") == 6
Select vvehlieninfo &&& updateable view
Replace app_inits With employeeinit
= Tableupdate(2,.t.,'vvehlieninfo')
WAIT WINDOW "Vehicle Lien Information Saved Successfully" TIMEOUT 1.5 AT 40,40
Else
= TABLEREVERT(.T.,'vvehlieninfo')
WAIT WINDOW "Vehicle Lien Information Was Not Saved" TIMEOUT 1.5 AT 40,40
ENDIF


I know the underlying table never gets updated because I requery it and it doesn't contain the changes.
I have the underlying table cursorsetprop(buffering",5,"tablename")...

Any ideas as to why this would not save to the underlying table? Also, as stated in the title - have 'Send SQL updates" IS checked.

Thanks in advance
Angie
 
ahaws,

You probably have an additional layer of buffering that exists...umm...I think you could confirm if this is the case by calling tableupdate() twice instead of once and see if values actually make it to the underlying table.

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
I agree with Slighthaze. The problem is that you're doing double-buffering, which you probably don't want to do. If you buffering the underlying table, you not only have to do a TABLEUPDATE() on the view, but a second one on the underlying table. There are only a few specific cases where this is needed, so I would recommend you don't buffer the underlying table at all.


-BP (Barbara Peisch)
 
Angie,

Although Barbara and Slighthaze have almost certainly given you the right answer, you might also just double-check have actually enabled the updatable fields. In the Update Criteria tab of of the View Designer, check that you have a tick under the pencil icon for every field that you want to be updatable.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi guys ( and gals)-
I tried issuing 2 tableupdates()....no good.
at the point that I tried, I have no buffering on the main table - so I called twice tableupdate(2,.t.,'viewname')


Mike-
All fields are checked for update.(except primary key of course


I have used updateable views before and have never experienced this....

any other suggestions>
Thanks
Angie
 
To go back to your original code, you don't check the return value of your TABLEUPDATE commands. How do you know it was successful? Are you designating a key field in your view that uniquely identifies a record in the source table? Also, you say you don't update the PK. Don't assume that this isn't necessary just because the default is to not to update it. If you have an insert trigger for the source table that assigns the PK when the record is added, then you probably don't want to update the PK, but otherwise, you probably do.


-BP (Barbara Peisch)
 
I have the same problem as "ahaws" i Really don't why it won't update the base table, have tried everything, i really need some help. Is this an vfp8 issue ? caues i come from vfp5 and used the same techniques through vfp7 and never had encountered this problem, I would really appreciate the help.
 
Hi keuyiar-
I issue a TABLEUPDATE on the view as well as the table...that seems to work.

** Save changes?
lcsuccess = cursorsetprop('buffering',5,'tablename')
if lcsuccess
=tableupdate(2,.t.,'viewname')
=tableupdate(2,.t.,'tablename')
else
** some error message
endif

Hope this helps..
Ahaws


 
Thanks for the feedback ahaws, but it's not working for me either, and the thing is, that it doesn't show me any error message or anything, i wrote the code as you described and it doesn't show the error message in case the 'cursorsetprop' isn't applied either. Are there any SETS y must specify or some special settings to establish. By the way, the table i'm using is a free table, i only keep the views on the database. !
Thanx
 
Hi Again Kueyiar
>> By the way, the table i'm using is a free table, i only keep the views on the database.!
Same here.
Are you making sure that the "Send Updates" is checked in the Update Criteria section of the view?
I use VFP 7.0, although I Do not think if matters.


 
kueyiar-
Hi Again-
You would have to write your own error message...something like:
messagebox("UpDate was Not Successful",16)----

So
lcsuccess = cursorsetprop('buffering',5,'tablename')
if lcsuccess
=tableupdate(2,.t.,'viewname')
=tableupdate(2,.t.,'tablename')
else
messagebox("UpDate was Not Successful",16)
endif
 
Im sorry, maybe I misunderstood...
if it doesnt update, it never gets to the error message?
You could try stepping through to see how far it gets in code..
let me know
angie
 
this is the strange thing, i've stepped into the code and it went through every line of code as if everything where ok..
Here's the code :

varASIGNBUFFER=CURSORSETPROP('BUFFERING',5,'Charges')

IF varASIGNBUFFER
=TABLEUPDATE(2, .t., 'vCharges')
=TABLEUPDATE(2, .t., 'Charges')

ELSE
WAIT WINDOW 'NOT CHANGED..'

ENDIF

And this is the code generaded by vfp 8 on the view designer : (I checked the send sql updates, established the pk, updatable fields and everythin, i just don't understand why it doesn't work !! )

SELECT *;
FROM ;
charges;
WHERE Charges.code LIKE ( ?parA )

DBSetProp(ThisView,"View","SendUpdates",.T.)
DBSetProp(ThisView,"View","BatchUpdateCount",1)
DBSetProp(ThisView,"View","CompareMemo",.T.)
DBSetProp(ThisView,"View","FetchAsNeeded",.F.)
DBSetProp(ThisView,"View","FetchMemo",.T.)
DBSetProp(ThisView,"View","FetchSize",100)
DBSetProp(ThisView,"View","MaxRecords",-1)
DBSetProp(ThisView,"View","Prepared",.F.)
DBSetProp(ThisView,"View","UpdateType",1)
DBSetProp(ThisView,"View","UseMemoSize",255)
DBSetProp(ThisView,"View","Tables","charges")
DBSetProp(ThisView,"View","WhereType",3)

DBSetProp(ThisView+".code","Field","DataType","C(5)")
DBSetProp (ThisView+".code","Field","UpdateName","charges.code")
DBSetProp(ThisView+".code","Field","KeyField",.T.)
DBSetProp(ThisView+".code","Field","Updatable",.T.)

DBSetProp(ThisView+".desc","Field","DataType","C(30)")
DBSetProp(ThisView+".desc","Field","UpdateName","charges.desc")
DBSetProp(ThisView+".desc","Field","KeyField",.F.)
DBSetProp(ThisView+".desc","Field","Updatable",.T.)

DBSetProp(ThisView+".value","Field","DataType","N(9,2)")
DBSetProp(ThisView+".value","Field","UpdateName","charges.value")
DBSetProp(ThisView+".value","Field","KeyField",.F.)
DBSetProp(ThisView+".value","Field","Updatable",.T.)

antonio.
 
HI Antonio-
do you have SET MULTILOCKS ON?
Angie
 
Hi again-
looking at my code that I had a problem with earlier-
Craidsboyd had offered:
>>You probably have an additional layer of buffering that exists...umm...I think you could confirm if this is the case by calling tableupdate() twice instead of once and see if values actually make it to the underlying table.

I saw that I actually had this:

lcsuccess = cursorsetprop('buffering',5,'tablename')
if lcsuccess
=tableupdate()
=tableupdate(2,.t.,'viewname')
=tableupdate(2,.t.,'tablename')
else
messagebox("UpDate was Not Successful",16)
endif


So- Maybe issue a tableupdate() before issuing the two others...
try that and let me know.
Angie





 
Hi angie,
Tried your suggestion, no luck :(
Another thing, if i run a browse directly on the view, as u can see i have an input parameter, well, i input the data i wish the view to display, so far so good, i change it directly on the browse window, apply a =tableupdate(.t.), it appears to have worked perfectly, but as i try to run a =REQUERY() to check and see if it got updated i gen a "Syntax error" message, i then issue a =TABLEREVERT(.T.) and that does work and reverts the changes i made, i then issue a =REQUERY() and no error message appears, as a matter of fact the input window for the parameter appears for me to input data with no error, ..any ideas.
How could i know if "You probably have an additional layer of buffering that exists" is true ?
Thanx
antonio.
 
Hi Angie,

I suspect that the views you are telling may not be of same spec. To explain what I mean, the development project and the table/view in the project will be having updatable view. However, the specific field could remain unchecked for updates in your view in the working environment. SO check along the path of the DBC which is in the working environemnt and check the views updatable boxes and verify if they are in order.

Occassionaly, we keep looking elsewhere for correction and the error could be sitting in an unexpected place. :)

:)

____________________________________________
ramani - (Subramanian.G) :)
 
hi Ramani,
I've checked the paths, the set default/path strings and they seem to be correct, i've checked de send updates, pk, updatable fields and everything is ok, i don't know what else too do, any other suggestions ?
what do you mean by "the specific field could remain unchecked for updates in your view in the working environment" ?
 
Hi Ramani-
I didnt that of that...thanks.

Hi Antonio
If I understand Ramani-
If you are using a form, then in the Data Environment of the form you should be able to see which .dbc your view is pointing to.
Find the 'charges' table that your 'vcharges' is pointing to in your DE of your form.
Make sure that the base 'table' for that view is in the working environment.

Ramani?
Am I following you correctly I always seemed confused for a minute when I build database containers, because I use all free tables, since we have existing FOX2.6 apps that need to access the tables as well (cannot include tables in .dbc).
So the confusion comes when I build the views, as to which table should I use to build upon to get to my work directory, or should use the tables in the 'live data' on the network.
I guess my question is, do I have to build a separate .dbc for my work area and one for the 'live' network?

Thanks-trying to kill two birds with 1 stone...
angie

Thanks
angie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top