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.