1

嗨,我正在使用带有数据集的 Crystal Report,但是当我运行报表时,它显示空白记录,听到的是我的代码

    private void UpdateReport()
    {
        try
        {
            DateTime StDate = dtpFrom.Value;
            DateTime EdDate = dtpTo.Value;
            DataSet reportData = new DataSet();
            SqlConnection conn = new SqlConnection(DBConnect.CaptureManagerConnectionSting);
            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter();
            SqlCommand cmd = new SqlCommand("SP_GetBountyModelGrouping", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Region", SqlDbType.NVarChar).Value = cboRegion.Text;
            cmd.Parameters.Add("@Country", SqlDbType.NVarChar).Value = cboCountry.Text;
            cmd.Parameters.Add("@StDate", SqlDbType.NVarChar).Value = StDate.ToShortDateString();
            cmd.Parameters.Add("@EdDate", SqlDbType.NVarChar).Value = EdDate.ToShortDateString();
            da.SelectCommand = cmd;
            da.Fill(reportData, "DataTableBountyModelGrouping");
            conn.Close();
            crptBountyModelGrouping rptDoc = new crptBountyModelGrouping();
            rptDoc.SetDataSource(reportData.Tables[0]);
            crystalReportViewer1.ReportSource = rptDoc;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

请帮助我谢谢 VG .Salger

4

0 回答 0