Solved

Datasources

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

15 Experts available now in Live!

Get 1:1 Help Now