Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用vs 2013使用access数据库显示crystal报表_C#_Crystal Reports - Fatal编程技术网

C# 使用vs 2013使用access数据库显示crystal报表

C# 使用vs 2013使用access数据库显示crystal报表,c#,crystal-reports,C#,Crystal Reports,我是一名编程新手,我使用dataset和crystal report viewer创建了一个带有access db的WFP csharp程序,其中包含两个报告。其中一个报告显示,而另一个显示空列,我已重新检查了连接字符串,所有内容似乎都很好,这是一个示例代码,rptCustomers显示来自db的数据,rptSales显示空行,是否有问题 private void btnCustRpt_Click_1(object sender, EventArgs e) {

我是一名编程新手,我使用dataset和crystal report viewer创建了一个带有access db的WFP csharp程序,其中包含两个报告。其中一个报告显示,而另一个显示空列,我已重新检查了连接字符串,所有内容似乎都很好,这是一个示例代码,rptCustomers显示来自db的数据,rptSales显示空行,是否有问题

private void btnCustRpt_Click_1(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                timer1.Enabled = true;
                rptCustomers rpt = new rptCustomers();
                //The report you created.
                cmd = new OleDbCommand();
                OleDbDataAdapter myDA = new OleDbDataAdapter();
                SIS_DBDataSet myDS = new SIS_DBDataSet();
                //The DataSet you created.
                con = new OleDbConnection(cs);
                cmd.Connection = con;
                cmd.CommandText = "SELECT * from Customer order by CustomerName";
                cmd.CommandType = CommandType.Text;
                myDA.SelectCommand = cmd;
                myDA.Fill(myDS, "Customer");
                rpt.SetDataSource(myDS);
                frmCustomersReport frm = new frmCustomersReport();
                frm.crystalReportViewer1.ReportSource = rpt;
                frm.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            {
                try
                {
                    Cursor = Cursors.WaitCursor;
                    timer1.Enabled = true;
                    rptSales rpt = new rptSales();
                    //The report you created.
                    cmd = new OleDbCommand();
                    OleDbDataAdapter myDA1 = new OleDbDataAdapter();
                    SIS_DBDataSet myDS1 = new SIS_DBDataSet();
                    //The DataSet you created.
                    con = new OleDbConnection(cs);
                    cmd.Connection = con;
                    cmd.CommandText = "SELECT * from Sales order by CustomerID";
                    cmd.CommandType = CommandType.Text;
                    myDA1.SelectCommand = cmd;
                    myDA1.Fill(myDS1, "Sales");
                    rpt.SetDataSource(myDS1);
                    frmSalesReport frm = new frmSalesReport();
                    frm.crystalReportViewer1.ReportSource = rpt;
                    frm.Visible = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

我终于明白了,我的查询不完整,我补充道,我终于明白了,我的查询不完整,我补充道