Page 1 of 1

Data source data can not used in another data source as a variable

Posted: Mon Jun 22, 2009 9:46 am
by ngoptr
In the older version, I was able to use data from a data source in another data source, but use it as a variable. After I update/upgrade to the 2009 version, it keep saying "Object reference not set to an instance of an object." when I try to preview the report.

For example:
I have dsDataSet1, and dsDataSet2. In the query text of dsDataSet2, I have:
SELECT * FROM Table1 WHERE ColumnName = {dsDataSet1.ColumnName}

Any help is appreciated and thank you.

Data source data can not used in another data source as a variable

Posted: Tue Jun 23, 2009 6:59 am
by Jan
Hello,

I think problem in order of datasources in report dictionary. If one datasource come in report dictionary before sedond you can't use field from second in first datasource, because second is not connected.

Thank you.

Data source data can not used in another data source as a variable

Posted: Tue Jun 23, 2009 8:39 am
by ngoptr
The order of the dataset is this: dsDataSet1 is first, then the dsDataSet2 come in second. It always top to bottom. I call the field that come before, not after.

Data source data can not used in another data source as a variable

Posted: Wed Jun 24, 2009 8:44 am
by Jan
Hello,

Please set ConnectOnStart property of dsDataSet2 to false. In BeforePrintEvent of first page write following code:

Code: Select all

dsDataSet2.Connect();
Let me know about results.

Thank you.