Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL passthrough
Message
From
20/09/2002 03:41:41
 
 
To
19/09/2002 21:31:37
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00702210
Message ID:
00702618
Views:
15
Mike,

I'm not sure I understand your problem. Are you saying that when you re-issue your SQLEXEC() after modifying the data from the command window, the result set of the SQLEXEC() doesn't reflect these changes? What happens if you do the following?
*-- SQL Server northwind database
*-- get the customers
lcSql = "SELECT * FROM customers"
SQLEXEC(o.inSql, lcSql, "customers")
?customers.region
*-- change some data on the backend from the command window
SQLEXEC(o.inSql, "UPDATE customers SET Region='MyRegion' WHERE customerId='ALFKI'")
*-- re-issue the SPT command
SQLEXEC(o.inSql, lcSql, "customers")
?customers.region
It looks like you are looking for a REQUERY() function. Unfortunately, REQUERY() only works with remote views but not with SPT. But if you re-execute the SQLEXEC() command, then you should get the latest data from the backend. One problem with this approach is that if you have a grid that is bound to an SPT cursor and you run the SQLEXEC() again, then the grid will loose all the settings because the SPT cursor is closed before it's recreated. To avoid this problem do the following:
lcRecordSource = ThisForm.YourGrid.RecordSource
ThisForm.YourGrid.RecordSource = ""
*-- requery backend
SQLEXEC(lnSql, lcSql)
*-- restore recordsource
ThisForm.YourGrid.RecordSource = lcRecordSource
I hope this helps. If I totally missed your question, then maybe you can provide some code to demonstrate the problems you have.

>Hi, I don't need to make the cursor created by SPT updateable. I only need to fectch the latest records from the base tables. The problem starts when new records where added or modified using Native codings or the command window. With this, the new modified or added records does not reflect on the cursor created by sqlexec() function.
>
>I noticed that by exiting the system and running it again, by the time you execute the same sqlexec() query, the records are up to date. My question is why do I need to exit my program and re run it in order to fetch the latest records?
>
>Please Help............
Daniel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform