Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Starting with cursorAdapter
Message
From
12/05/2005 03:57:57
 
 
To
12/05/2005 03:28:27
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01013277
Message ID:
01013280
Views:
18
>I'd like to start knowing something about CA
>I tried something with native tables but I stopped as I didn't really need that approach, but know I have to connect to a Non VFP DataSource and I thought it was a good idea to use CA class.
>The Database I need to use is a FileMaker Db but last night I tried something with a MS Access Database but I got into some problems :
>What should I do ? Is there anyone who would send me the instructions to connect properly to a MSAcces Db ?
>Thank you very much
>Alessio

Here an example:
*** Connection Strings to Access DB via ODBC
***# Standard Security:
**** "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"
*** #  Workgroup:
**** "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatabase.mdw;"
*** #  Exclusive:
**** "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=admin;Pwd=" 


DEFINE CLASS MyCA AS CursorAdapter

PROCEDURE Init
local llReturn
do case
    case not pemstatus(This, '__VFPSetup', 5)
        This.AddProperty('__VFPSetup', 0)
    case This.__VFPSetup = 2
        This.__VFPSetup = 0
        return
ENDCASE
this.Alias              = "WhatCursorAliasYouWant"
this.Tables             = "ListRemoteTablesYouUse"
this.WhereType          = 1                        &&Check CA.WhereType in Help
this.BreakOnError       = .t.
this.BufferModeOverride = 5                        && Cursor Buffering type
llReturn = dodefault()
*** Select connection code: DO NOT REMOVE
local lcDBC
set multilocks on

this.DataSourceType = "ODBC"
this.DataSource     = SQLSTRINGCONNECT("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=admin;Pwd=")  && See the strings above


*** End of Select connection code: DO NOT REMOVE
*** Setup code: DO NOT REMOVE
***<SelectCmd>
This.SelectCmd = "select ListRemoteTablesYouUse.[field list here, I don't use *] FROM ListRemoteTablesYouUse "+;
                         "WHERE whereClauseIfYouWant"

***</SelectCmd>
***<KeyFieldList>
This.KeyFieldList = "KeyFieldList"
***</KeyFieldList>

***<UpdateNameList>
This.UpdateNameList = "FieldFromCursor ListRemoteTablesYouUse.Field, ...."
***</UpdateNameList>



***<UpdatableFieldList>
This.UpdatableFieldList = "WhichFieldsYouWantToBeUpdated"
***</UpdatableFieldList>

*** End of Setup code: DO NOT REMOVE
if This.__VFPSetup = 1
    This.__VFPSetup = 2
endif
return llReturn


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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform