Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter with fox tables
Message
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01454562
Message ID:
01454583
Views:
71
Yes, I think it's exactly the case. See Cetin's answer and this thread for reference Re: VFPOLEDB Bug or ? Thread #1449715 Message #1449717

>>>I am trying to use cursoradapter class to acces fox tables....i know that this is not the best way to do it...but i have to make a multidatabase application and i need now to access fox tables and in the future sql tables....so i use cursoradapter to make the switch to sql in less time. Once i create the class and i have my cursor open if i append a new record i have a problem if in the table i have a date fields. If i don't compile it i receive an error message. My fox tables are not in a DBC container and are free tables....but i have the problem also with tables in dbc......Then all the empty date columns when i look at table with browse after use Table command are empty. If i use cursoradapeter these values are 30-12-2899.......
>>
>>Can you show some of your code for the CA class and also how do you try an insert? It may be related to the bug we discussed recently with Cetin.
>
>
>Here is my code:
>
>
>DEFINE CLASS _ado AS cursoradapter
>
>
>	Tag = "Provider=VFPOLEDB.1;Data Source=;"
>	Height = 22
>	Width = 23
>	Alias = "cursor1"
>	BufferModeOverride = 3
>	DataSourceType = "ADO"
>	Flags = 0
>	WhereType = 1
>	KeyFieldList = ""
>	UpdatableFieldList = ""
>	UpdateNameList = ""
>	AllowSimultaneousFetch = .T.
>	Name = "_ado"
>
>
>	PROCEDURE BeforeCursorFill
>		LPARAMETERS luseCursorSchema, lNoDataOnLoad, cSelectCmd
>		Local cSelect
>
>		lUseCursorSchema = .F.
>
>		With This
>			.CursorSchema = ""
>			.UpdatableFieldList = ""
>			.UpdateNameList		= ""
>			Endif
>		EndWith
>
>		DODEFAULT(luseCursorSchema, lNoDataOnLoad, cSelectCmd)
>	ENDPROC
>
>
>	PROCEDURE AfterCursorFill
>		LPARAMETERS luseCursorSchema, lNoDataOnLoad, cSelectCmd, lResult
>		cAlias = This.Alias
>
>		If Used(cAlias) And Empty(This.UpdatableFieldList)
>			For nn=1 To Fcount()
>				If !Empty(This.UpdatableFieldList)
>					This.UpdatableFieldList = This.UpdatableFieldList + " , "
>				Endif
>				This.UpdatableFieldList = This.UpdatableFieldList + Field(nn)
>				If !Empty(This.UpdateNameList)
>					This.UpdateNameList = This.UpdateNameList + " , "
>				Endif
>				This.UpdateNameList = This.UpdateNameList + Field(nn) + " " + cAlias + "." + Field(nn)
>			EndFor
>		Endif
>	ENDPROC
>
>
>	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=C:\Program Files\App\Data;Mod] + ;
>			[e=ReadWrite;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
>		*** 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: _ado
>**************************************************
>
>
>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform