Solved

Datasources

Posted on 1997-11-22
2
199 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 10 Seattle Dataset Actions 5 79
Delphi: how to send PJL commands to printer 3 90
Communication Between RC4 Delphi <-> PHP 3 100
Convert a string into a TDateTime 5 50
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now