Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Linux Server, ODBC Driver & Remote View
Message
De
25/11/2005 10:59:24
 
 
À
25/11/2005 09:19:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01071985
Message ID:
01072086
Vues:
27
Hello,

"Would you prefer spt over remote views just for the flexibility ? The app I'm testing is pretty straight forward and can survive with remote views."

You can mix SPT and remote views depending what is simpler for the specific query.

non updateable search/reporting queries are easier to write with SPT since you can build the query string dynamically e.g.

LOCAL lcLastName, lcFirstName, lcStreet, lcSQL, lcWhere, lbAnd

&& get querie values from user input
lbAnd = .F.
lcSQL = "SELECT someFields FROM yourTable "
lcWhere = ""

IF !EMPTY(lcLastname)
lcWhere = lcWhere + "yourTable.lastname LIKE '" + ALLTRIM(lcLastName) + "%'"
lbAnd = .T.
ENDIF
IF !EMPTY(lcFirstName)
IF lbAnd
lcWhere = lcWhere + " AND "
ENDIF
lcWhere = lcWhere + "yourTable.firstname LIKE '" + ALLTRIM(lcFirstName) + "%'"
ENDIF

IF !EMPTY(lcWhere)
lcSQL = lcSQL + " WHERE " + lcWhere
ENDID

SQLEXEC(connection,lcSQL,'yourquery')

for cursors that should be updateable a remoteview is easier to set up and work with. SPT result aren't updateable by default, but you can also make them updateable (see FAQ #8153).

if you mix them you can use one connection for both types.
e.g.

PUBLIC lnSQLConnection (or a property on your application object)
lnSQLConnection = SQLCONNECT(....) && or SQLSTRINCONNECT(...)

then you can open a remoteview with the CONNSTRING clause using the existing connection
e.g.
USE yourView IN 0 NODATA CONNSTRING lnSQLConnection

Regards
Christian
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform