Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Linux Server, ODBC Driver & Remote View
Message
From
25/11/2005 10:59:24
 
 
To
25/11/2005 09:19:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01071985
Message ID:
01072086
Views:
28
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
Previous
Reply
Map
View

Click here to load this message in the networking platform