如何使用带有Reportviewer的Linq将数据库与我的数据库绑定 [英] How Do I Bind Values From My Database Using Linq With Reportviewer

查看:97
本文介绍了如何使用带有Reportviewer的Linq将数据库与我的数据库绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Linq和Reportviewer我试图绑定它,以便我可以查看已经在我的数据库中为id 8的结果?不熟悉reportviewer的语法







protected void _subRebind(string user)

{



rpt_report.ProcessingMode = ProcessingMode.Local;

rpt_report.Reset();

rpt_report.LocalReport.Dispose();

rpt_report.LocalReport.DataSources.Clear();

ReportDataSource LabResults = new ReportDataSource();

LabResults.Name =LabResults;

DataTable dt = new DataTable();

LabResults.Value = dt;

rpt_report.LocalReport .ReportPath =Report1.rdlc;

rpt_report.LocalReport.DataSources [LabResults]。Value = objLab.getLabsByID(8);

rpt_report.DataBind();

rpt_report.LocalReport.Refresh();





}





Im using Linq and Reportviewer Im trying to bind it so that I can view the results of whats already in my database for id 8 ? not familiar with the syntax for reportviewer



protected void _subRebind(string user)
{

rpt_report.ProcessingMode = ProcessingMode.Local;
rpt_report.Reset();
rpt_report.LocalReport.Dispose();
rpt_report.LocalReport.DataSources.Clear();
ReportDataSource LabResults = new ReportDataSource();
LabResults.Name = "LabResults";
DataTable dt = new DataTable();
LabResults.Value = dt;
rpt_report.LocalReport.ReportPath = "Report1.rdlc";
rpt_report.LocalReport.DataSources["LabResults"].Value = objLab.getLabsByID(8);
rpt_report.DataBind();
rpt_report.LocalReport.Refresh();


}


public IQueryable<lab> getLabsByID(int _id)
{
    labDataContext objLAB = new labDataContext();

    var allLabs = objLAB.labs.Where(x => x.Id == _id).Select(x => x);

    return allLabs;
}

推荐答案

这篇关于如何使用带有Reportviewer的Linq将数据库与我的数据库绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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