Problem on Relational Objective Data

Stimulsoft Reports.NET discussion
Post Reply
nightbat
Posts: 6
Joined: Fri Jun 25, 2010 9:10 am

Problem on Relational Objective Data

Post by nightbat »

Hi there

The report works great if there was no relation between tblStudent and tblStudentScore in Common Layer.
Please review the project below and let me know if there is any solution.
thank you for your attention.

Project Files

:tire:
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Problem on Relational Objective Data

Post by Andrew »

Hello,

Your project does not work:
- there are no references to assemblies in a report,
- the list of fields of the bindingSource1 object in a report differs from the list of fields in the code,
- it is not understandable by what relation are you reffering to because there are no equal fields in the table.

Please send us a report sample which reproduces the issue and detailed descritpion of it.
Thank you.
nightbat
Posts: 6
Joined: Fri Jun 25, 2010 9:10 am

Problem on Relational Objective Data

Post by nightbat »

Hello and thank you for your attention,
- it is not understandable by what relation are you reffering to because there are no equal fields in the table.
as you see in db, tblStudent has relation with tblStudentScore on tblStudent.StudentId = tblStudentScore.StudentCode.
To implement this relation in .Net Layered Model, I used this Code in Common.tblStudentScore.cs file:

Code: Select all

...
public tblStudent Student {
            get { return _Student; }
            set { _Student = value; }
        }
        private tblStudent _Student;
...
To Fill this Property, I used this code in DataAccess Layer( "DataAccess.tblStudentScore.cs"):

Code: Select all

...
                   Common.tblStudentScore studentScore = new Common.tblStudentScore();

                    studentScore.StudentScoreId = Convert.ToInt32(dr["StudentScoreId"]);
                    studentScore.StudentCode = Convert.ToInt32(dr["StudentCode"]);
                    studentScore.Score1 = Convert.ToInt32(dr["Score1"]);
                    studentScore.Score2 = Convert.ToInt32(dr["Score2"]);

                    studentScore.Student = new tblStudent().SelectByPK(studentScore.StudentCode)[0];       //<============

                    studentScoreList.Add(studentScore);
...
It will work great without this relation in our code, but we have the following error with relation:

Code: Select all

error CS0246: The type or namespace name 'Common' could not be found (are you missing a using directive or an assembly reference?)

in the following code, "new Business.tblStudentBS().SelectAll()" returns data properly ( as it shows in quickwatch ):

Code: Select all

 StiReport report = new StiReport();
            report.RegData("bindingSource1", new Business.tblStudentBS().SelectAll());       // <=================
            report.Load("..\\..\\stiReport1.mrt");
            report.ScriptUpdate();
            report.Compile();
            report.Show();
What do you mean by :
- the list of fields of the bindingSource1 object in a report differs from the list of fields in the code,
We made this report using StiReport's ReportWizard .


BTW, this scenario works fine with Microsoft .Net Report. But we have(and LOVE) to do it with Stimulsoft Report.

Thank you for your time.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Problem on Relational Objective Data

Post by Ivan »

Hello,
nightbat wrote:It will work great without this relation in our code, but we have the following error with relation:

Code: Select all

error CS0246: The type or namespace name 'Common' could not be found (are you missing a using directive or an assembly reference?)
Please add "Common.Dll" to the ReferencedAssemblies list in report properties, and "using Common;" code to the begin of Code tab:

nightbat wrote:What do you mean by : the list of fields of the bindingSource1 object in a report differs from the list of fields in the code,
Your textboxes on Data databand contains following expressions:
{bindingSource1.StudentScoreId}
{bindingSource1.StudentCode}
{bindingSource1.Score1}
{bindingSource1.Score2}
This is fields of tblStudentScore object, but you register as "bindingSource1" the tblStudent structure.

Thank you.
Post Reply