Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help - CursorAdapter to Active Directory returning memos
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00932675
Message ID:
00932905
Vues:
18
Mark,

Being new to this, I guess I'm getting a bit confused. Does this mean that you can not actually make an ADO connection using just the default VFP CA Builder and the fields that it exposes through the Builder interface?

I guess what I'm saying is, I didn't have to create any ADO Connection or Recordset object in code. Everything I've done was through the builder ... the connection string, the select command, etc. Are you saying that the builder won't actually allow me to use the schema even though it provides a place for me to enter it?

I don't know if this makes a difference or not, but on the Properties page of the VFP CA builder, I have Data Source Type as ADO and Use Connection String selected ... not Use existing ADO Recordset.

From the sounds of it, I have to create my own Connection programatically and connect it to the CA before I can use the schema?

I will look into your CA class though. Thanks for sharing that with the VFP community!

Rodd

>You need to replace that with whatever you have created as the object reference to the ADO command object. The method code below is what I have in my CAs to setup ADO. "THIS" in the code below is the actual CA subclass so you will have to add appropriate properties to the CA for this to work.
>
>BTW, these CAs are created in a VCX using my CA VCX Builder which you can download for free with all source code and documentation from http://www.mctweedle.com and clicking the FoxPro tools link. The CABuilder PRG file has extensive comments on using the builder and using CAs in general.
>
>*!* You must have already established an ADO Connection Object.
>*!*   The assumption is that you establish this connection when
>*!*   the application is started and the object reference is being
>*!*   stored in either a public/private variable [this is OK] or an
>*!*   Application Object [goApp, better way]. Then set the value of
>*!*   the oADO_Conn property in this CA baseclass to the goApp
>*!*   property or variable.
>LOCAL luOldValue
>luOldValue = THIS.oADO_Conn
>IF TYPE("THIS.oADO_Conn") = "C" AND NOT EMPTY(THIS.oADO_Conn)
>   *!* converts the property value from a string to an object ref
>   THIS.oADO_Conn = EVALUATE(THIS.oADO_Conn)
>ENDIF
>IF TYPE("THIS.oADO_Conn.Provider") <> "C"
>   *!*   if the Provider property does not exist,
>   *!*   the object is not an OLEDB provider.
>   THIS.oADO_Conn = luOldValue
>   RETURN .F.
>ENDIF
>THIS.oADO_RS      = NEWOBJECT('ADODB.Recordset')
>THIS.oADO_Command = NEWOBJECT('ADODB.Command')
>IF TYPE("THIS.oADO_RS") <> "O" OR TYPE("THIS.oADO_Command") <> "O"
>   RETURN .f.
>ENDIF
>THIS.oADO_Command.ActiveConnection = THIS.oADO_Conn
>WITH THIS.oADO_RS
>   .ActiveConnection = THIS.oADO_Conn
>   .CursorType       = 1  && adOpenKeyset
>   .CursorLocation   = 3  && adUseClient
>   .LockType         = 3  && adLockOptimistic
>ENDWITH
>THIS.DataSource = THIS.oADO_RS
>IF NOT THIS.lAutoGenerate
>   THIS.UpdateCmdDataSourceType = [ADO]
>   THIS.UpdateCmdDataSource     = THIS.oADO_Command
>   THIS.DeleteCmdDataSourceType = [ADO]
>   THIS.DeleteCmdDataSource     = THIS.oADO_Command
>   THIS.InsertCmdDataSourceType = [ADO]
>   THIS.InsertCmdDataSource     = THIS.oADO_Command
>ENDIF
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform