c#中rdlc报表提示“尚未为数据源..提供数据源实例”??
rdlc报表已经设置好,路径也没有错,请高手帮忙看看是哪里出问题了??没有分了,不好意思啊,跪求答案了。。privatevoidForm4_Load(objectsend...
rdlc报表已经设置好,路径也没有错,请高手帮忙看看是哪里出问题了??没有分了,不好意思啊,跪求答案了。。
private void Form4_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“lWkqDataSet.pdb200412”中。您可以根据需要移动或移除它。
DataSet ds = new DataSet();
ds = dss();
Microsoft.Reporting.WinForms.ReportDataSource r = new Microsoft.Reporting.WinForms.ReportDataSource();
r.Name = "lWkqDataSet";
r.Value = ds.Tables[0];
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportPath = @"../../Report4.rdlc";
this.pdb200412TableAdapter.Fill(this.lWkqDataSet.pdb200412);
this.reportViewer1.RefreshReport();
}
DataSet dss()
{
SqlConnection conn = new SqlConnection("server=(local);database=22;uid=sa;pwd=;");
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Num, EmNum, EmName, Birthday, Sex, Dept, Diploma, EmType, InDate, IdCard, PayCal, NatPlace, PostCode, Tel, DwPlace, Job, Ext, Email, BasePay, Remark, OnJob, OutDate, Cause, Card, CardDate, OnIdCard FROM dbo.desmployee2 where id<30 ",
conn);
DataSet de = new DataSet();
da.Fill(de, "a");
conn.Close();
return de;
} 展开
private void Form4_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“lWkqDataSet.pdb200412”中。您可以根据需要移动或移除它。
DataSet ds = new DataSet();
ds = dss();
Microsoft.Reporting.WinForms.ReportDataSource r = new Microsoft.Reporting.WinForms.ReportDataSource();
r.Name = "lWkqDataSet";
r.Value = ds.Tables[0];
this.reportViewer1.LocalReport.DataSources.Add(r);
this.reportViewer1.LocalReport.ReportPath = @"../../Report4.rdlc";
this.pdb200412TableAdapter.Fill(this.lWkqDataSet.pdb200412);
this.reportViewer1.RefreshReport();
}
DataSet dss()
{
SqlConnection conn = new SqlConnection("server=(local);database=22;uid=sa;pwd=;");
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Num, EmNum, EmName, Birthday, Sex, Dept, Diploma, EmType, InDate, IdCard, PayCal, NatPlace, PostCode, Tel, DwPlace, Job, Ext, Email, BasePay, Remark, OnJob, OutDate, Cause, Card, CardDate, OnIdCard FROM dbo.desmployee2 where id<30 ",
conn);
DataSet de = new DataSet();
da.Fill(de, "a");
conn.Close();
return de;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询