不可发言的成员不能像方法一样使用 [英] Non-invocable member cannot be used like a method

查看:101
本文介绍了不可发言的成员不能像方法一样使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在下面.


my code is below.


protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument rptDoc=new ReportDocument();
        DataSet_example ds =new DataSet_example();
        SqlConnection conn=new SqlConnection();
        conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["con1"].ConnectionString;
        DataTable dt=new DataTable();
        dt.TableName="Crystal report example";
        SqlDataAdapter da=new SqlDataAdapter("Select * from sample",conn);
        da.Fill(dt);
        ds.Tables(0).Merge(dt);
        rptDoc.Load(Server.MapPath("CrystalReport.rpt"));
        rptDoc.SetDataSource(ds);
        CrystalReportViewer1.ReportSource=rptDoc;

    }




错误是用粗体线表示的,无法使用成员"Dataset_example.tables"不能像方法那样使用.dataset_example是数据集名称(.xsd).有谁能帮帮我吗?
< edit>添加了代码块




error is at bold line that is Non-invocable member ''Dataset_example.tables'' cannot be used like a method.where dataset_example is the dataset name(.xsd).can any one help me out?
<edit>Added Code Block

推荐答案

您可能打算写ds.Tables[0].

现在再次查看错误消息,尝试找出最初不清楚的地方.

—SA
You probably meant to write ds.Tables[0].

Now look at the error message again and try to figure out, what was unclear in first place.

—SA


我认为您需要编写以下突出显示的行

I think you need to write the highlighted line as below

ds.Tables[0].Merge(dt);



注意方括号.

希望对您有帮助
Milind



Note the sqaure bracket.

Hope that helps
Milind


这篇关于不可发言的成员不能像方法一样使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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