DataTable dt =
if (dt.Rows.Count > 0)
{
dt.Columns.Add("photo", typeof(System.Byte[]));
foreach (DataRow row in dt.Rows)
{
string path = get photo path where photo save;
if (path != "0")
{
int imageHeight = 200;
int imageWidth = 150;
System.Drawing.Image fullSizeImg
= System.Drawing.Image.FromFile(path);
System.Drawing.Image.GetThumbnailImageAbort dummyCallBack
= new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing.Image thumbNailImg
= fullSizeImg.GetThumbnailImage(imageWidth, imageHeight,
dummyCallBack, IntPtr.Zero);
MemoryStream ms = new MemoryStream();
string s = path.Substring(path.LastIndexOf('.') + 1, 3).ToLower();
if (s == "jpg")
{
thumbNailImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
}
else
{
thumbNailImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
}
row["photo"] = ms.ToArray();
ms.Close();
thumbNailImg.Dispose();
}
}
CrystalReportSource1.Report.FileName = Server.MapPath("/Report/AdmitCard.rpt");
CrystalReportSource1.ReportDocument.SetDataSource(dt);
fsApplication.Visible = true;
CrystalReportSource1.DataBind();
CrystalReportViewer1.Visible = true;
use photo field in Schema
<xs:element name="photo" type="xs:base64Binary" xmlns:xs="http://www.w3.org/2001/XMLSchema" />