Solved

Datasources

Posted on 1997-11-22
2
202 Views
Last Modified: 2010-04-04
I am creating a component in D1 and I have to refer to either
a TTable or TQuery as the Datasource.  I have coded the following:

If (DataSource.Dataset as TTable) = ..... then
else
If (DataSource.Dataset as TQuery) = ....  then

I have to use that construct several times within the component
and I want to know if there is a simpler way to do it, like by
setting a variable for the (DataSource.Dataset as TTable) or TQuery
part. If so, what type of variable do I need?

Thanks in advance for any help
0
Comment
Question by:jdthedj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1351409
Hi jdthedj,

What about this? Make a boolean function of it like :

function IsTable:Boolean;
begin
 if (DataSource.DataSet as TTable) then Result := true
  else Result := false;
end;

In your component, you can call this function :

 if IsTable then ...
  else ....

It's shorter and easier.

Have fun,
c.u. ZifNab;
0
 
LVL 3

Author Comment

by:jdthedj
ID: 1351410
Thanks ZifNab!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question