将数据源设置为水晶报告

时间:2016-09-11 15:10:18

标签: c# vb.net

我通过代码创建了数据表,并将这些表添加到数据集中。他们工作正常。但是当我将这个数据集传递给我的报告时,我什么都没得到。我的代码

Dim dt As DataTable = New DAL().selectdatatable(String.Format("SELECT PT.PT_Code, PT.age_sex2, PT.fullname2, Ptsense.PT_Date, DR.Dr_Name, Ptsense.sample, Ptsense.G, Ptsense.coun, Ptsense.comm, Ptsense.organism, Ptsense.lowsens FROM (PT INNER JOIN Ptsense ON PT.PT_Code = Ptsense.PT_Code) INNER JOIN DR ON PT.DR_Code = DR.Dr_Code WHERE PT.PT_Code={0} AND Ptsense.PT_Date=#{1}# AND Ptsense.lowsens <>'{2}'", Txtcode.Text, DateTimePicker1.Value.ToString("dd/MM/yyyy"), ""))
Dim dt3 As DataTable = New DAL().selectdatatable(String.Format("SELECT  labdetails.labnme, labdetails.labspecial, labdetails.labadress, labdetails.labphone, labdetails.labtime, labdetails.lablogo,labdetails.labnameenglish,labdetails.labspecialenglish  FROM labdetails;"))
Dim dt4 As DataTable = New DAL().selectdatatable(String.Format("SELECT PT.PT_Code, PT.age_sex2, PT.fullname2, Ptsense.PT_Date, DR.Dr_Name, Ptsense.sample, Ptsense.G, Ptsense.coun, Ptsense.comm, Ptsense.organism, Ptsense.lowsens, Ptsense.resis FROM (PT INNER JOIN Ptsense ON PT.PT_Code = Ptsense.PT_Code) INNER JOIN DR ON PT.DR_Code = DR.Dr_Code WHERE PT.PT_Code={0} AND Ptsense.PT_Date=#{1}# AND Ptsense.resis <>'{2}'", Txtcode.Text, DateTimePicker1.Value.ToString("dd/MM/yyyy"), "")) 
Dim ds As New DataSet
ds.Tables.AddRange({dt, dt3, dt4})
rprt.SetDataSource(ds)

0 个答案:

没有答案