Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Microsoft sql server compact edition oledb provider
Message
 
À
16/02/2009 18:07:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows XP
Divers
Thread ID:
01382195
Message ID:
01382222
Vues:
48
>Quickly generated using dataexplorer.app ( DO HOME() + "DataExplorer.app" )
>
>* This script handles the ADO Connection and uses a CursorAdapter object
>* to retrieve data to a cursor.
>
>PUBLIC oCA as CursorAdapter
>LOCAL oConn as ADODB.Connection
>LOCAL oRS as ADODB.Recordset
>LOCAL oException AS Exception
>LOCAL cConnString
>
>* Handle connections - insert connection code
>cConnString = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;"+;
>  "Data Source=C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\northwind.sdf"
>TRY 
>    oConn  = createobject('ADODB.Connection')
>
>    * Ensure that you handle userid and password if not 
>    * specified in connection string.
>    *   ex. oConn.Open(cConnString, userid, password)
>    oConn.Open(cConnString)
>
>    oRS = CREATEOBJECT("ADODB.Recordset")
>    oRS.DataSource.CursorLocation = 3   &&adUseClient
>    oRS.DataSource.LockType = 3   &&adLockOptimistic
>    oRS.ActiveConnection = oConn
>
>    oCA=CREATEOBJECT("CursorAdapter")
>    oCA.DataSourceType = "ADO"
>    oCA.DataSource = oRS
>    oCA.MapBinary = .T.
>    oCA.MapVarchar = .T.
>
>    oCA.Alias = "customers"
>    oCA.SelectCmd = "SELECT * FROM customers"
>    
>    IF !oCA.CursorFill()
>        * Replace with error code here
>        LOCAL laError
>        DIMENSION laError[1]
>        AERROR(laError)
>        MESSAGEBOX(laError[2])
>    ELSE
>        * Replace with user code here. Code below allows for
>        * you to edit and send updates to the backend.
>        LOCAL laFlds,lcStr,lnFldCount,i
>        DIMENSION laFlds[1]
>        lnFldCount=AFIELDS(laFlds)
>        lcStr=""
>        FOR i = 1 TO lnFldCount
>                lcStr = lcStr + laFlds[m.i,1] +  ","
>        ENDFOR
>        oCA.UpdatableFieldList = lcStr
>        BROWSE NORMAL NOWAIT
>    ENDIF
>
>CATCH TO oException
>    * Replace with exception handling code here
>    MESSAGEBOX(oException.Message)
>
>ENDTRY
>
>* Add user code here.
>* Note: cursors created by CursorAdapter object are closed when object is released.
>
Cetin

i've also tried same way :) but was missing only BROWSE NORMAL NOWAIT
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform