The IListSource does not contain any data sources. <-- ?

K

KK

Hi

When I execute an SQL steatement, I retreive a
Dataset. For some queries which does not
return any data, If I assign it to the
datagrid.datasource and bind, it throws the following
exception
The IListSource does not contain any data sources.

However, dataset doesn't say its NULL. So that Ican
check for null and if its null, I don't bind it to grid.

Jist, as to test, I did a
System.Diagnostics.Debug.WriteLine(results.GetXml());
and if there are no data it just outputs a "<NewDataSet />"
which says no data. Everytime, when this happens if I
assign to grid it throws the above exception.

There should be a nice way to check this isn't it?

How can I avoid this error?
rgds
KK
 
S

Srimathi

Hi,

I think you can check for the tables count and if the tables
(Dataset.Tables.Count) count is greater than 0, then you can bind it to the
datagrid.

Srimathi.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top