Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to know if behind an alias is a view or a table?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hello to all!
I am having a dataform which have as main datasource a view or a table.
Part of an auto-save mode it might be required to know wether the datasource is table or view (view must be requeried afterwards).
How do I know wether or not datasource is view or table?
-Bart
 
Bart,

In the case of tables, are they always DBC-resident tables, or might they also be free tables? And, if always DBC-resident, will they be in the same DBC as the views?

If so, then you only have to call ADBOBJECTS() with "VIEW" as the second param. If the table or view name is present in the array, it is a view.

If you only know the alias (as opposed to the name of the table or view within the DBC), you can use DBF() to get the name of the object returned by ADBOBJECTS().

Does that solve the problem?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
select alias()
isview = Inlist(CursorGetProp("sourcetype"),1,2),.T.,.F.)

1 = local view
2 = remote view
3 = table
4 = record set
 
Imaginecorp makes an excellent recommendation with CursorGetProp. You can also see if it's a free or a database table by CursorGetProp('database','alias').

There are even more SourceType values now, to denote if it's a cursoradapter cursor, and if that is genereated by oCA.CursorFill() or was attached by oCA.CursorAttach().

ConnectHandle and ConnectName hint on a remote view and DBF() hint's on a cursor (.TMP extension) vs a table file (DBF) too.

Bye, Olaf.
 
Thanks to all of you!
With these valuable solutions I now am able to find out when to requery a view or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top