in my project I need to allow the user (admin user) to have the ability to run custom queries on the database. Ive done this pretty simply whwer the user enters their query and the reults are set to a datagridview.

It would also be great however to allow the user to print the results of their custom query. For this I thought the easiest thing to do would be to use a crystal report.

However the problem Im encountering is that because the dataset that the datagrid is populated from is empty until the user fires the query, the crystal report cant find any source for the data to be displayed.

Can anyone think of a better way to do this or am I approaching this in completely the wrong way?

Hope that makes sense and thanks in advance!


suppose your dataset is DS

check this kind of condition..

if DS.Tables(0).Rows.Count >0 then

"load your report"


MessageBox.Show("Nothing to Print")

End IF
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.