Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / FoxPro / Database Container / July 2008

Tip: Looking for answers? Try searching our database.

SELECT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc - 04 Jul 2008 11:20 GMT
I have a command in a PRG
SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
Before executing this command two tables are opened and 'fNames'
table is selected as the current alias.
After executing this command fTrmVars table is created and relevant records
also there.
But 'fTmpNames' doesn't select as the current alias
Still the current alias is 'fNames'

lcAliasBef = ALIAS()
SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
lcAliasAfter = ALIAS()
Stefan Wuebbe - 04 Jul 2008 12:00 GMT
>I have a command in a PRG
> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
[quoted text clipped - 7 lines]
> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
> lcAliasAfter = ALIAS()

But you would have expected that the "Into Cursor" alias should be
the selected one afterwards, right?
A typical thing causing unexpected current workareas is a Grid as the
active control of an active form while your code (or even report) is
running, so the workaround would be to do anotherControl.SetFocus()
in advance.

Does that help?
-Stefan

Signature

|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
 - /  See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------

Marc - 07 Jul 2008 04:49 GMT
Thanks Stefan
It solved the problem
I set the SetFocus to another object.

>>I have a command in a PRG
>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
[quoted text clipped - 23 lines]
>  - /  See us at www.prolib.de or www.AFPages.de
> -----------------------------------------------------------
Craig Berntson - 09 Jul 2008 15:57 GMT
Just a point of clarification. The SELECT command  in the question does not
create a table. It creates a cursor. What's the difference? A table resides
on disk and is generally considered permanent. A cursor may reside totally
in memory, is read-only by default, and is automatically deleted when
closed.

Signature

Craig Berntson
Microsoft MVP

-------------

>I have a command in a PRG
> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
[quoted text clipped - 8 lines]
> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
> lcAliasAfter = ALIAS()
Marc - 11 Jul 2008 09:54 GMT
Yes that is a temporary cursor. But afterthat SELECT * .... command the
creating cursor should be selected, but it not happens like that. Im calling
that prg by doubleClicking the grid. Therefore the grid recordsource table
is always selected. Because of that the creating cursor is not selecting.
Is there any way to avoid this.?

> Just a point of clarification. The SELECT command  in the question does
> not create a table. It creates a cursor. What's the difference? A table
[quoted text clipped - 14 lines]
>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>> lcAliasAfter = ALIAS()
Craig Berntson - 11 Jul 2008 15:49 GMT
Explicitly SELECT the cursor/table you want

Signature

Craig Berntson
Microsoft MVP

-------------

> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
> calling that prg by doubleClicking the grid. Therefore the grid
> recordsource table is always selected. Because of that the creating cursor
> is not selecting.
> Is there any way to avoid this.?
Fred Taylor - 11 Jul 2008 23:38 GMT
The grid ALWAYS wants to have as the current area its recordsource.  You'll
have to either move the Focus off the grid to some other control before you
do your SQL SELECT, or you'll have to SELECT the cursor before you try to
use it.

Signature

Fred
Microsoft Visual FoxPro MVP

> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
[quoted text clipped - 21 lines]
>>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>>> lcAliasAfter = ALIAS()
Anders Altberg - 12 Jul 2008 22:55 GMT
Hi Marc
Functions that operate on cursor, practically always take the cursorname as
a last, optional parameter.
Commands tha operate on table proctacally always take an optional clause 'IN
cursoralias'
Make a habit of using them and you don't have to very much about selecting a
workarea.

-Anders

> Yes that is a temporary cursor. But afterthat SELECT * .... command the
> creating cursor should be selected, but it not happens like that. Im
[quoted text clipped - 21 lines]
>>> SELECT * FROM fNames INTO CURSOR fTmpNames WHERE Int_key=11
>>> lcAliasAfter = ALIAS()
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.