Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating DBC with ADO
Message
De
27/06/2007 09:28:28
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01235859
Message ID:
01235981
Vues:
11
>I MADE IT!!!!
>After 4 days fight with CAs :-)

Hi Borislav,

Thanks so much !
This works exactly how I desired.

4 days ?
Wow ! Thanks again...

After all this fight, would you recommend to go through this path... or will there be much more difficulties ?

Regards

Cesar


>>I'm totally unexperienced with remote data access, and I'm trying to access my DBC using CursorAdapters with OLEDB.
>>
>>I managed to create my CA vcx, using Mark McCasland CABuilder for VFP9.
>>
>>In the DBC I have some AutoInc fields as PK, and I'm being able to update and delete data normally.
>>
>>But I noticed that when I insert data, the PK field is not updated, even after I send a TABLEUPDATE() command.
>>
>>I can only see the AutoInc values after I close my form that uses the CA.
>>
>>Is this the normal behavior or is there any way to allow me to see the AutoInc field updated ?
>>
>>Thanks in advance
>>
>>Cesar
>
>I MADE IT!!!!
>After 4 days fight with CAs :-)
>(based on your example)
>
>
>ooo = NEWOBJECT([oCA])
>ooo.CursorFill()
>APPEND BLANK
>REPLACE name WITH [Test], forum WITH [TEST]
>TABLEUPDATE(1,.t.)
>BROWSE
>
>
>**************************************************
>*-- Class:        oca (f:\testca\otest.vcx)
>*-- ParentClass:  cursoradapter
>*-- BaseClass:    cursoradapter
>*-- Time Stamp:   06/27/07 12:40:06 AM
>*
>DEFINE CLASS oca AS cursoradapter
>
>
>	Tag = ['Provider=VFPOLEDB.1;Data Source=F:\TestCA\TestCA.DBC;Password="";Collating Sequence=MACHINE;']
>	Height = 22
>	Width = 23
>	SelectCmd = "select forum, id, name from clients"
>	CursorSchema = "FORUM C(10), ID I, NAME C(10)"
>	Alias = "crsclients"
>	DataSourceType = "ADO"
>	Flags = 0
>	WhereType = 1
>	KeyFieldList = "ID"
>	Tables = "clients"
>	UpdatableFieldList = "FORUM, NAME"
>	UpdateNameList = "FORUM clients.forum, ID clients.id, NAME clients.name"
>
>	InsertCmdRefreshFieldList = "ID"
>	InsertCmdRefreshKeyFieldList = "Id"
>	InsertCmdRefreshCmd = "SELECT Id FROM Clients WHERE Id = GETAUTOINCVALUE(0)"
>	Name = "oca"
>
>
>	PROCEDURE Init
>		*** Setup code: DO NOT REMOVE
>		local llReturn
>		do case
>			case not pemstatus(This, '__VFPSetup', 5)
>				This.AddProperty('__VFPSetup', 0)
>			case This.__VFPSetup = 1
>				This.__VFPSetup = 2
>			case This.__VFPSetup = 2
>				This.__VFPSetup = 0
>				return
>		endcase
>		set multilocks on
>		llReturn = dodefault()
>		*** End of Setup code: DO NOT REMOVE
>		*** Select connection code: DO NOT REMOVE
>
>		local loConnDataSource
>		loConnDataSource = createobject('ADODB.Connection')
>		***<DataSource>
>		loConnDataSource.ConnectionString = [Provider=VFPOLEDB.1;Data Source=F:\TestCA\TestCA.DBC;Password="";Collating] + ;
>			[ Sequence=MACHINE;]
>		***</DataSource>
>		loConnDataSource.Open()
>		This.DataSource = createobject('ADODB.RecordSet')
>		This.DataSource.CursorLocation   = 3  && adUseClient
>		This.DataSource.LockType         = 3  && adLockOptimistic
>		This.DataSource.ActiveConnection = loConnDataSource
>
>******************** THESE ARE THE IMPORTANT SETTINGS
>		loConnDataComm  = createobject('ADODB.Command')
>		loConnDataComm.ActiveConnection = loConnDataSource
>		this.InsertCmdDataSourceType = [ADO]
>		this.InsertCmdDataSource     = loConnDataComm
>*****************************************
>		*** End of Select connection code: DO NOT REMOVE
>
>		*** Setup code: DO NOT REMOVE
>		if This.__VFPSetup = 1
>			This.__VFPSetup = 2
>		endif
>		return llReturn
>		*** End of Setup code: DO NOT REMOVE
>	ENDPROC
>
>
>	PROCEDURE AutoOpen
>		*** Setup code: DO NOT REMOVE
>		if not pemstatus(This, '__VFPSetup', 5)
>			This.AddProperty('__VFPSetup', 1)
>			This.Init()
>		endif
>		*** End of Setup code: DO NOT REMOVE
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: oca
>**************************************************
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform