No value in the datasource????

Stimulsoft Reports.NET discussion
Post Reply
abhi0410
Posts: 47
Joined: Fri Sep 26, 2008 12:42 pm
Location: bombay

No value in the datasource????

Post by abhi0410 »

Hi,,,

When my datasource doesn't return any value or set of particular column then i dont want to show the report and just want to show the pop up msg

How to do?????

actually when my datasource doesn't return anything then i am able to show msg but after clicking on OK button the report is shown with no value..

So i dont want to show the report and i want to return my application...How to do???

Plus for example when my datasource is returning value like column1 column2 column3 column4

and when no value present in the column3 and column4 then i want to show the pop msg....

basically i am using stored procedure and in the stored procedure i have made couple of joins for table and i am getting the value....
so like my employers address details i will get from different table but i may not get his work exp details from different table....
So at the moment i dont want to show the report and jus a pop up msg saying some msges....

Thanks... Hope i am clear....
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

No value in the datasource????

Post by Edward »

Hi.

Just place the code for analysis of all these values in the BeginRender event of the Report object. You can access these event in the Designer. Just select 'Report' object in the 'Properties' window and switch to the Events page via the button with yellow lightning image.

Stored procedure is represented as the DataSource in the Dictionary and might be executed and checked in code too, e.g.:

Code: Select all

myStoredProcedure.Connect();
if (myStoredProcedure.IsEmpty) 
{
MessageBox.Show("SP is empty");
Stop = true;
}
And you can check value of the DataColumn too:

Code: Select all

if (IsNull(MyDataSource,"MyDataColumn"))
{
	MessageBox.Show("There is no value.");
}
This checking also can be made inside of the report's Dialog Form.

For not showing of the report it is enough the following assignment in the code of the form:

Code: Select all

// the report will not be rendered
Form1.DialogResult = DialogResult.Cancel;
//  the report will be rendered
Form1.DialogResult = DialogResult.OK;
You can add this code inside of the ButtonClickEvent of the button. If the DialogResult of the Button is 'None' then you can decide whether to show the report or not.

Thank you.
Post Reply