值不在预期范围内

值不在预期范围内

本文介绍了值不在预期范围内-crystalreports错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个水晶报表,该报表显示数据集中的数据.当我运行该程序时,它不显示任何数据,但是数据集具有许多记录.它显示错误值不在预期范围内".我在Crystal报表中不使用任何参数.
帮我.谢谢.
代码如下.

Hi all, I have a crystal report that displays data from a dataset. When i run the program it does not display any data but the dataset has a number of records. It shows an error ''value does not fall within the expected range''. I do not use any parameters in crystal report.
Help me. Thanks.
The code is follows.

private void Form1_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds.Tables.Add("Doctors");
            Get_Doctors();
            CrystalReport1 rpt = new CrystalReport1();
            rpt.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rpt;
        }
        private void Get_Doctors()
        {
            da = new SqlDataAdapter("SELECT D_Name,D_Address_L1 from doctors", Dbcon);
            da.Fill(ds, "Doctors");
        }

推荐答案

rpt.SetDataSource(ds.Tables[0]);
OR
rpt.SetDataSource(ds.Tables["Doctors"]);


这篇关于值不在预期范围内-crystalreports错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-02 16:15