水晶报表ModuleNames水平分布

时间:2019-07-18 13:19:16

标签: c# crystal-reports

我的数据集包含以下各列 1. PRN 2.姓名 3.模块名称 4.理论标记 5.总成绩 该数据集是具有相同过程的不同模块的字段,数据来自数据库

我已将此数据集数据提供给Crystal Report作为数据源

我想以以下格式在ModuleName下显示TheoryMark和totalMarks

       ModuleName1              ModuleName2              ModuleName3

PRN名称理论标记TotalMarks理论标记TotalMarks

我已经尝试过使用Module Name进行分组列。我也曾尝试过CrossTab Expert,但是它不允许我添加理论分数和总分

string reportPath;     字符串pathText =“ PGCourseResultCrystalreport”;

string path = "PGCourseResult.rpt";

if (pathText == "PGCourseResultCrystalreport")
{

    reportPath = Server.HtmlEncode(Request.PhysicalApplicationPath).ToString() + "MemberArea\\ResultReport\\" + path;
    rptDoc.Load(reportPath);
    error.Text += "reportdocloaded";
    //DataTable Resut = GetResultData();

    try
    {


        string query = "select P.PRN, P.[StudentName] ,P.TheoryMarks,L.TotalMarks,L.ModuleName from   [PGCoursesTheoryMarksMaster]  P,[ModulewiseLabInternalMarks] L  where L.PRN=P.PRN and P.Centre_ID=L.CentreId and P.Course_ID=L.Course_ID and P.Module_ID=L.Module_ID and P.Batch_ID=L.Batch_ID and P.Centre_ID=@centreId and P.Course_ID=@courseId   and P.Batch_ID=@batchId ";
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["aoldbConnectionString"].ConnectionString);

        string centreID = DDLCentreList.SelectedValue;
        //   string BatchID = BatchIdDropDown.SelectedValue;
        int  CourseId =  Convert.ToInt32( DropDownListCourse.SelectedValue);
        SqlCommand cmd = new SqlCommand(query, con);
        cmd.Parameters.AddWithValue("@CentreId", Convert.ToInt32(centreID));
        cmd.Parameters.AddWithValue("@courseId", CourseId);
        cmd.Parameters.AddWithValue("@batchId", batchId);
        if (con.State == ConnectionState.Open)
        {
            con.Close();
        }
        con.Open();
        using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
        {
            sda.Fill(CourseMarks, "MainResultData");
            foreach (DataRow row in CourseMarks.Tables[0].Rows)
            {
                error.Text += row["PRN"].ToString();
            }

我想按说明显示结果。

1 个答案:

答案 0 :(得分:0)

CrossTab是正确的方法。 让CrossTab进行总计。 换句话说,不要选择总计作为CrossTab值,而是选择详细数据,然后让CrossTab进行求平均值,求和等。

相关问题