Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating remote views
Message
De
08/09/1998 08:56:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00133969
Message ID:
00134013
Vues:
15
>Hi Cetin,
>
>>Being frankly, seeing tableupdate(0...) after replace all I didn't check the rest. tableupdate(0) would tableupdate current rec and after replace all you're at eof(). use tableupdate(1 or 2) instead.
>
>That's more a typo than anything else, I tried 1 and 2 and no errors were generated or returned in the array, but no update occurred either.

Mark,
If you are defining view all programmatically then you should change it to something like :
set safe off
use \temp\tmpTable
lnFields = AFIELDS(laFields)
use
CLOSE DATA ALL
CREATE DATABASE 'c:\temp\TEST.DBC'

***************** View setup for TMPVIEW ***************

CREATE SQL VIEW "TMPVIEW" ; 
   REMOTE CONNECT "Visual FoxPro Tables" ; 
   AS SELECT * FROM c:\temp\tmptable Tmptable

DBSetProp('TMPVIEW', 'View', 'UpdateType', 1)
DBSetProp('TMPVIEW', 'View', 'WhereType', 3)
DBSetProp('TMPVIEW', 'View', 'FetchMemo', .T.)
DBSetProp('TMPVIEW', 'View', 'SendUpdates', .T.)
DBSetProp('TMPVIEW', 'View', 'UseMemoSize', 255)
DBSetProp('TMPVIEW', 'View', 'FetchSize', 100)
DBSetProp('TMPVIEW', 'View', 'MaxRecords', -1)
DBSetProp('TMPVIEW', 'View', 'Tables', 'tmptable')
DBSetProp('TMPVIEW', 'View', 'Prepared', .F.)
DBSetProp('TMPVIEW', 'View', 'CompareMemo', .T.)
DBSetProp('TMPVIEW', 'View', 'FetchAsNeeded', .F.)
DBSetProp('TMPVIEW', 'View', 'FetchSize', 100)
DBSetProp('TMPVIEW', 'View', 'Comment', "")
DBSetProp('TMPVIEW', 'View', 'BatchUpdateCount', 1)
DBSetProp('TMPVIEW', 'View', 'ShareConnection', .F.)

	FOR lnTeller = 1 TO lnFields
	 lcField = 'tmpView.' + laFields[lnTeller,1]

	DBSetProp(lcField, 'Field', 'KeyField', .F.)
	DBSetProp(lcField, 'Field', 'Updatable', .T.)
	DBSetProp(lcField, 'Field', 'UpdateName', "tmpTable."+laFields[lnTeller,1])
	cDataType = laFields[lnTeller,2]
	do case
		case cDataType $ "C"
			cDataType = cDataType+"("+str(laFields[lnTeller,3])+")"
		case laFields[lnTeller,2] $ "NF"
			cDataType = cDataType+;
                              "("+;
                               str(laFields[lnTeller,3])+;
                               ","+;
                               str(laFields[lnTeller,4])+")"
	endcase
    DBSetProp(lcField, 'Field', 'DataType', cDataType)

*!*	 IF laFields[lnTeller, 2] $ 'DT'
*!*	 *!* Empty data(time) fields result in {30-12-1899}
*!*	 *!* instead of empty fields, so replace
*!*	 REPLACE ALL (laFields[lnTeller,1]) WITH { } ;
*!*	 FOR EVAL(laFields[lnTeller,1]) = {30-12-1899}
*!*	 ENDIF
*!*	 IF PCOUNT() > 1 AND laFields[lnTeller,1] $ UPPER(tcIndex)
*!*	 DBSETPROP(lcField, 'Field', 'KeyField', .T.)
*!*	 ENDIF
	ENDFOR


	DBSetProp("tmpview.makb_no", 'Field', 'KeyField', .t.)

*!*	FOR lnTeller = 1 TO lnFields
*!*	 lcField = 'tmpView.' + laFields[lnTeller,1]
*!*	 DBSETPROP(lcField, 'Field', 'Updatable', .T.)
*!*	ENDFOR

use tmpView
CURSORSETPROP('Buffering', 5, 'tmpView')


REPLACE ALL nRecId WITH recno()
TABLEUPDATE(2, .T., 'tmpView')
CLEAR ALL
USE C:\TEMP\tmpTable
BROWSE
To make it easy, do it in view designer then run gendbc to get programmatic version.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform