Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to handle RI in CursorAdapter?
Message
De
15/01/2004 21:32:51
Czarina Joyce Villanueva
Innovision Systems International
Manila, Philippines
 
 
À
15/01/2004 01:21:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00866953
Message ID:
00867344
Vues:
22
Aleksey,

Look at my code below and tell me what's wrong or lacking?
Public pvDBConnstring, nConn
pvdbconnstring = "Driver=SQL Server;Server=SQL;uid=sa;pwd=sapassword;Database=bbox"
nConn = SQLStringConnect(pvdbconnstring)
If nConn <= 0
   MessageBox("connection failed")
   Return
Endif

Set Procedure To sampleca Additive
oSampleMstr = CreateObject("caSampleMstr")
oSampleMstr.Alias = 'samplemstr'
oSampleMstr.CursorFill(.T.,.F.)
Select samplemstr
Insert Into samplemstr (refdate, fullname) Values (Date(), 'CZARINA')

Wait Window Str(oSampleMstr.ctrlno) && returns zero always

TableUpdate(1,.T.,'samplemstr')

Close All

Procedure sampleca

	Define Class caSampleMstr As CursorAdapter

		DataSourceType = 'ODBC' && 'XML', 'NATIVE', 'ADO'
		AllowUpdate = .T.
		AllowDelete = .T.
		AllowInsert = .T.
		SendUpdates = .T.
		
		CursorSchema = [ctrlno Int(4), refdate D(8), fullname C(50)]
		Selectcmd = [Select ctrlno, refdate, fullname From samplemstr]
		UpdatableFieldList = [refdate, fullname]
		UpdateNameList = [refdate samplemstr.refdate, fullname samplemstr.fullname]
		Tables = 'samplemstr'
		BuffermodeOverride = 5
		KeyFieldList = 'ctrlno'
		Wheretype = 3
		
		Procedure Init
		    *-- The data source is our Connection Handle
		    This.DataSource = nConn
		    This.AddProperty('ctrlno',0)
		EndProc

		Procedure AfterInsert
		LPARAMETERS cFldState, lForce, cInsertCmd, lResult
			This.ctrlno = samplemstr.ctrlno			
		EndProc	

EndDefine
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform