Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug on CursorAdapter.UpdateType where i can report the b
Message
From
11/11/2002 08:17:12
Emanuele Bonin
EB Soluzioni Informatiche
Tezze S/B, Italy
 
 
To
10/11/2002 10:51:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00719735
Message ID:
00720936
Views:
19
Hi Doug

>I can't reproduce this. When I created a CursorAdapter similar to yours ...

I subclassed CursorAdapter to catch the InsertupdateCmd and Deletecmd on BeforeUpdate and this is the result:

UpdateType = 2 <<< WHY ? i forced it


InsertUpdateCMD = INSERT INTO AbiCab2 (Descrizione) VALUES (?abicab2.descrizione)
DeleteCMD = DELETE FROM AbiCab2 WHERE id_AbiCab=?OLDVAL('id_abicab','abicab2')

This is My Example:
-- SQL SCRIPT Start here
ABICAB2 is a Simple table:
CREATE TABLE [abicab2] (
[id_abicab] [int] IDENTITY (1, 1) NOT NULL ,
[cd_abicab] [varchar] (10) NOT NULL ,
[descrizione] [varchar] (100) NULL
)
ALTER TABLE Abicab2 add constraint pk_abicab2 primary key nonclustered (id_abicab)

INSERT Abicab2(cd_abicab, decsrizione) value(0000100001, 'Dummy')
-- End Sql Script

** Start VFP Program

SQLSETPROP(0, 'displogin', 1)

nHandle = SQLSTRINGCONNECT('DRIVER=SQL SERVER;SERVER=WXP04;APP=Microsoft Visual FoxPro;WSID=WXP04;DATABASE=ADB_Demo;Trusted_Connection=Yes')
IF nhandle <=0
RETURN
ENDIF

o = NEWOBJECT('MyCursor', SYS(16))
o.DatasourceType = "ODBC"
o.Datasource = nHandle
o.SelectCmd = "SELECT * FROM AbiCab2 WHERE Cd_AbiCab LIKE '01%'"
o.Alias = 'AbiCab2'
o.buffermodeoverride = 5
o.Tables = 'AbiCab2'
o.KeyFieldList = 'Id_AbiCab'
o.updatablefieldlist = 'Descrizione'
o.updatenamelist = 'id_AbiCab AbiCab2.id_AbiCab, Descrizione AbiCab2.Descrizione'
o.SendUpdates = .t.
o.allowupdate = .t.
o.allowdelete = .t.
o.allowinsert = .t.
o.updatetype = 1

if o.CursorFill()
SELECT (o.Alias)
** Modify the description of first record!
REPLACE Descrizione WITH Descrizione + 'PP'
IF !TABLEUPDATE(1, .T., o.Alias)
aerror(laErrors)
messagebox(laErrors[2])
ENDIF
o.cursorRefresh()
else
aerror(laErrors)
messagebox(laErrors[2])
endif


RELEASE o
RETURN
DEFINE CLASS MYCursor AS CursorAdapter
FUNCTION BeforeUpdate(cFldState, lForce, UpdateType, UpdateInsertCmd, DeleteCmd)
ACTIVATE SCREEN
clear
? UpdateType
? UpdateInsertCmd
? DeleteCmd
_cliptext = UpdateInsertCmd + CHR(13) + CHR(10) + DeleteCmd
RETURN DODEFAULT(cFldState, lForce, UpdateType, UpdateInsertCmd, DeleteCmd)
ENDFUNC
ENDDEF
** End VFP Program


Thanx in advance for help!
bye, Emanuele!
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform