值不在预期范围内-crystalreports错误 [英] value does not fall within the expected range - crystalreports error

查看:105
本文介绍了值不在预期范围内-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);

Modify this line:
rpt.SetDataSource(ds);
to
rpt.SetDataSource(ds.Tables[0]);
OR
rpt.SetDataSource(ds.Tables["Doctors"]);


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆