Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 733
  • Last Modified:

How to set Query's property DataSource with null source?

I set Query's Property DataSource for linking to Master Table,
such as: Query1.DataSource:=DataSource1.
But in running time, sometimes I want Query1 working independing.
Therefore I have to release this Master/Detail relation.
I wrote Query1.DataSource:='', and got compiler error.
Anyone can tell me how to define Query's property DataSource for a null source?
Thanks!

ps:When I define Query1.DataSource:=DataSource2,which DataSource2 point to nothing table.
And it is working, but I know it is not good method.


0
abdate
Asked:
abdate
1 Solution
 
ImbeginnerCommented:
hi abdate,

you can define another datasource as say you
or
you can use this work (closing the  query1)

 with query1.close the last data in dbgrid is disappeared

but about null datasource in delphi help:

All datasets must be associated with a data source component if  their data is to be displayed and manipulated in data-aware  controls. Similarly, each data-aware control needs to be associated  with a data source component in order for the control to receive and  manipulate data.


best regards
m.reza


0
 
kretzschmarCommented:
use

Query1.DataSource:=nil;

instead

meikl ;-)
0
 
abdateAuthor Commented:
Yes!It works.
Thanks!!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now