Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remote view not updating SQL back end
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00597869
Message ID:
00599041
Views:
21
I checked out the article and one related one. They pretty much show the same as what I have here. The related article it spoke of doing it with the GUI when building the remote view OR via code. I was doing both, which must have screwed things up. I kept the remote view settings and it worked. One thing that also may have helped as well was explicitly defining the tableupdate() parameters using Tableupdate(2, .F., [Mytable]).

Thanks.

>Hi Joy,
>
>There's mskb #Q138094 How to Create Updatable Views by Using SQL Passthrough.
>
>>I must be missing something. I am upscaling this app to a SQL back end. The TABLEUPDATE() AND SQLCOMMIT() values both return .T., but when I browse the remote view the updates are not there. Not sure if an intermediate cursor is confounding the issue. Here's the guts of the code:
>>MULTILOCKS and BUFFERING =5 are in the load of the form
>
>>SET STEP ON
>>*** at this point the stat bar indicates that the cursor that populates a grid
>>*** that filters the remote view is in the current work area
>>nHandle =sqlconnect([MYsystemDSN])
>>=sqlsetprop(nhandle, [Transactions], 2)
>>=SQLExec(nHandle, [SELECT * FROM Mytable])
>>*** the work-area cursor is now SQLresult
>>=CURSORSETPROP('Tables', 'Mytable')
>>=CursorSetProp([KeyFieldList], [Track_no], [Mytable])
>>=CursorSetProp([UpdatableFieldList], listupdate, [Mytable])
>>=CursorSetProp([SendUpdates], .T., [Mytable])
>>=CursorSetProp([UpdateNameList], listFields, [Mytable])
>>SELECT Mytable
>>*** if the above line is used, the Watch window correctly indicates that
>>***Mytable.claim_no gets changed using the REPLACE statements below to the new value that was changed on the form.
>>***If it is commented out SQLresult.claim_no shows that it is
>>***changed.  Neither case updates the back end.
>>
>>IF Thisform.mEdit= .T.
>>	LOCATE FOR Track_no =Thisform.Track_no1.Value
>>ENDIF
>>	DO CASE
>>	CASE Thisform.TermChk.Value	=.T. AND !EMPTY  Thisform.TermDate1.Value) ;
>>			AND !EMPTY(Thisform.cbo_Term1.Value)
>>			Thisform.Mr_Stat1.Value	=[T]
>>		CASE Thisform.Mrchka.Value	=.T. AND !EMPTY(Thisform.Mr_apr1.Value)
>>			Thisform.Mr_Stat1.Value	=[A]
>>		CASE (Thisform.Mrchkd.Value =.T. AND !EMPTY(Thisform.Mr_Ref1.Value))
>>			Thisform.Mr_Stat1.Value	=[D]
>>		CASE (Thisform.Mrchkd.Value =.F. AND Thisform.Mrchka.Value =.F. ;
>>			AND Thisform.TermChk.Value	=.F. AND !EMPTY(Thisform.Mr_Sent1.Value))
>>			Thisform.Mr_Stat1.Value	=[W]
>>		CASE Thisform.Mrchkd.Value	=.F. AND Thisform.Mrchka.Value =.F. ;
>>		 AND EMPTY(Thisform.Mr_Sent1.Value)
>>			Thisform.Mr_Stat1.Value	=[N]
>>	ENDCASE
>>
>>	WITH Thisform
>>		REPLACE Clinic_ID 	WITH .Clinic_ID.Value
>>		REPLACE Group_ID 	WITH .Group_ID.Value
>>		REPLACE Mr_Stat			WITH .Mr_Stat1.Value
>>		REPLACE First_Name		WITH .First_Name1.Value
>>		REPLACE Last_Name		WITH .Last_Name1.Value
>>		REPLACE Init_date		WITH .Init_Date1.Value
>>		REPLACE Claim_no		WITH .Claim_no1.Value
>>		REPLACE From_Date		WITH .From_Date1.Value
>>		REPLACE To_Date			WITH .To_Date1.Value	
>>		REPLACE Init_refu		WITH .Init_refu1.Value
>>		REPLACE Mr_Due			WITH .Mr_Due1.Value
>>		REPLACE Mr_apr			WITH .Mr_apr1.Value
>>		REPLACE Mr_ref			WITH .Mr_ref1.Value
>>		REPLACE Recon_due		WITH .Mr_ref1.Value + cCarrlist.Recon_Days
>>		REPLACE Mr_Sent			WITH .Mr_sent1.Value
>>		REPLACE Treat_Cost		WITH .Treat_Cost1.Value
>>		REPLACE DenyMedr		WITH .cboDenyMR1.Value
>>		REPLACE Terminat		WITH .Termchk.Value
>>		REPLACE TermDate		WITH .TermDate1.Value
>>		REPLACE TermReas		WITH .cbo_Term1.Value
>>		REPLACE DocCntrl		WITH .DocCntrl1.Value
>>		REPLACE MRchka			WITH .MRchka.Value
>>		REPLACE UPIN			WITH .UPIN1.Value
>>		REPLACE Carrier			WITH .cboCarrier.Value
>>		IF Thisform.Mrchka.Value	=.T.
>>			REPLACE Appr_date	WITH .Mr_apr1.Value
>>		ENDIF
>>		REPLACE MRchkd			WITH .MRchkd.Value
>>		REPLACE Cnn_MR			WITH .Cnn_Num1.Value
>>		REPLACE Track_no		WITH .Track_no1.Value
>>		mSuccess=TABLEUPDATE(2, .F., [Mytable])
>>		If mSuccess
>>			Messagebox([Table successfully updated],0+64,[Information])			
>>		ELSE
>>			Messagebox([Table not updated please check the code],0+64,[Information])
>>		ENDIF
>>		IF mSuccess
>>			SQLSuccess= SQLCOMMIT(nHandle)
>>			IF SQLSuccess =1
>>				Messagebox([SQL COMMIT successfully completed],0+64,[Information])
>>			ELSE
>>				Messagebox([SQL COMMIT NOT completed],0+64,[Error])
>>				ROLLBACK
>>			ENDIF
>>		ENDIF
>

>>
>>While still in the debugger, I can browse MysystemDSN!Mytable and see no changes, but strangely enough, if I issue a REPLACE claim_no with [AAAA], do a TABLEUPDATE() AND SQLCOMMIT() in the command window, the changes show in the back end.
>>
>>TIA for any help.
CLARC Services, Inc.
3500 Tamiami Trail
Port Charlotte, FL 33952
www.clarc.com
(941) 743-0108
(800) 246-5488
Previous
Reply
Map
View

Click here to load this message in the networking platform