[英]In crystal report ,2nd table from dataset not getting displayed
In crystal report I am trying to display both tables of datatset ds
,but only table[0] is getting displayed in crystal report , table[1]
is not getting displayed why this is so ,I checked table[1] data is filled properly in that ,where is the problem? 在水晶报表我想显示的两个表
datatset ds
,但只表[0]越来越显示在水晶报表, table[1]
中,无法显示为什么会是这样,我检查表[1]的数据正确填写在那里,问题出在哪里?
private void ViewR_Load(object sender, EventArgs e)
{
String str = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string path = str + "\\images\\";
CrystalReportP objRpt;
// Creating object of our report.
objRpt = new CrystalReportP();
DataSetPatient ds = new DataSetPatient(); // .xsd file name
DataTable dt = DBHandling.GetPatient();
ds.Tables[0].Merge(dt);
DataTable dt1 = new DataTable();
//dt1.Columns.Add("Images", typeof(Bitmap));
dt1.Columns.Add("Images", typeof(Byte[]));
if (System.IO.Directory.Exists(path))
{
string[] allImg = System.IO.Directory.GetFiles(path);
foreach (string imgName in allImg)
{
drow = dt1.NewRow();
// define the filestream object to read the image
FileStream fs;
// define te binary reader to read the bytes of image
BinaryReader br;
// check the existance of image
// open image in file stream
fs = new FileStream(imgName, FileMode.Open);
// initialise the binary reader from file streamobject
br = new BinaryReader(fs);
// define the byte array of filelength
byte[] imgbyte = new byte[fs.Length + 1];
// read the bytes from the binary reader
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
drow[0] = imgbyte;
// add the image in bytearray
dt1.Rows.Add(drow[0]);
// add row into the datatable
br.Close();
// close the binary reader
fs.Close();
// close the file stream
}
}
try
{
ds.Tables[1].Merge(dt1);
}
catch (Exception r)
{
}
objRpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = objRpt;
}
在Crystal的Field Explorer
报表中,Just Cheking是否两个表都都添加到了它的Database Field
,如果不添加,则添加后就正常了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.