Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server 2008 table as a record source
Message
De
18/02/2016 04:01:38
 
 
À
17/02/2016 14:11:41
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01620689
Message ID:
01631649
Vues:
42
>>>>>Even though I can add, amend, and delete records in a table in a SQL server using SQL passthrough and can create a view too using an odbc driver to create a connection
>>>>>What I don't know is what the best way of having either of these as a record source in a grid, I would like to requery this grid at regular intervals, say one a minute
>>>>
>>>>IMO cursoradapter, as you do not even to look into SafeSelect technique to be used as a source for grids.
>>>>llOK = caYourTable.CursorRefresh()
>>>
>>>Actually wrong (writing this to myself as a note for the next time), the .cursorRefresh() and Refresh() and Requery() will all reexecute CA's .selectCmd as it was when the CA was instantiated, no matter what you set it to meanwhile. Only .cursorFill() will take the newly set .selectCmd and query using that.
>>>BTW, if you've set the first parameter of .cursorFill() to .t. and the .cursorSchema is empty, it will not give you an error (you can catch it in .afterCursorFill(), if lResult=.f., with aError(), it will just not reopen the cursor.
>>>And it does close and reopen the cursor, so safe select is still required, if you use a grid.
>>
>>I interpreted ", I would like to requery this grid at regular intervals, say one a minute" as using the same filter. Have you tested that .CursorRefresh() needs safe select ? if so, we must have done some coding in our CursorAdapter_base... Not at the right machine for some days here
>
>Um, I wasn't clear and have omitted part of the context. .CursorRefresh() is grid safe if you're OK with the same SQL command being used over and over. If your grid needs to contain search results, with custom where clause every time, then setting .selectCmd to this new command and .cursorFill() are needed, but then it's not grid safe any more.

Sigh - no need to worry about early Alzheimer here today ;-)
As I surmised the OP was only after records changed/added/deleted by other machines/program instances, that case would be covered.

Even for the UC of different WhereFilters in SelectCmd needed, I probably would try if a special CA could handle the safe select gymnastics with a few lines of code to keep data layer on one mechanism ;-))
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform