c#中的.rdlc报告不显示任何输出数据?

c#中的.rdlc报告不显示任何输出数据?,c#,dataset,rdlc,C#,Dataset,Rdlc,我的朋友们正在使用VisualStudio2008,我用c#开发了一个小项目,现在我想在其中添加报表(.rdlc报表)。这是我的密码 try { reportViewer1.Reset(); con.Open(); command.Connection = con; command.CommandType = CommandType.StoredProcedure;

我的朋友们正在使用VisualStudio2008,我用c#开发了一个小项目,现在我想在其中添加报表(.rdlc报表)。这是我的密码

 try
        {
            reportViewer1.Reset();
            con.Open();
            command.Connection = con;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "select_book_specific";

            param = new SqlParameter("@isbn", "isbn1");
            param.Direction = ParameterDirection.Input;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            adapter = new SqlDataAdapter(command);
            adapter.Fill(ds);


         //  for (int i = 0; i <= ds.Tables[0].Columns.Count - 1; i++)
           // {

             //   MessageBox.Show(ds.Tables[0].Rows[0][i].ToString());

            //} For testing purpose

            this.reportViewer1.LocalReport.ReportPath = @"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Report1.rdlc";


this.reportViewer1.LocalReport.DataSources.Add(newReportDataSource("Books",ds.Tables[0].TableName.ToString()));
this.reportViewer1.RefreshReport();


}
catch(exception ex){messageBox.show(ex.message);}
试试看
{
reportViewer1.Reset();
con.Open();
command.Connection=con;
command.CommandType=CommandType.storedProcess;
command.CommandText=“选择特定书籍”;
param=新的SqlParameter(“@isbn”、“isbn1”);
参数方向=参数方向输入;
param.DbType=DbType.String;
命令.Parameters.Add(param);
adapter=newsqldataadapter(命令);
适配器。填充(ds);
//对于(int i=0;i尝试

try
{
    reportViewer1.Reset();
    con.Open();
    command.Connection = con;
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "select_book_specific";

    param = new SqlParameter("@isbn", "isbn1");
    param.Direction = ParameterDirection.Input;
    param.DbType = DbType.String;
    command.Parameters.Add(param);

    adapter = new SqlDataAdapter(command);
    adapter.Fill(ds);
    this.reportViewer1.LocalReport.ReportPath = @"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Report1.rdlc";
    this.reportViewer1.LocalReport.DataSources.Clear();
    this.reportViewer1.LocalReport.DataSources.Add( new ReportDataSource(ds.DataSetName + "_" + ds.TableName, ds.Tables[0]));
    this.reportViewer1.LocalReport.Refresh();
}catch(Exception ex)
{
    messageBox.show(ex.message);
}

你的问题是什么?什么是
newReportDataSource
你能显示代码吗?@lc抱歉pal itz我的问题是报告没有显示任何数据?@Damith-在new关键字和ReportDatasource关键字之间应该是
newReportDataSource
当我在我的问题末尾添加你的答案时,有一个空格只显示reportViewer,不显示任何报表,调试并查看在添加为报表数据源之前表是否有记录,并检查报表路径。是否有异常?我已用完整代码更新了答案。请检查。没有异常,我使用for循环检查了数据集。它是ok报表路径也正确,但没有异常reportVierwer中是否没有显示报告