You must Sign In to post a response.
  • Category: .NET

    How to Implemented varbinary image in report

    Hi
    I have developed windows application for following fields

    name,empno,image -> varbinary(max)

    how to show corresponding record using crystal report

    any one show step by step

    share with me

    using dataset or storedprocedure
  • #767022
    Hi,

    by using EncryptByPassPhrase and DecryptByPassPhrase in sql server.
    Ex :
    declare @encrypt varbinary(200)
    select @encrypt = EncryptByPassPhrase('key', 'abc' )
    select @encrypt

    select convert(varchar(100),DecryptByPassPhrase('key', @encrypt ))

    Regards,
    Kalandiyur Subramanian Mohan
    www.mohanks.com

  • #767033
    Hi,
    Do this:

    DataTable dtTable = new DataTable();
    DataRow drRow;
    dtTable.Columns.Add("Image", System.Type.GetType("System.Byte[]"));
    drRow = dtTable.NewRow();
    FileStream fs = new FileStream(ImageFilePath + "\\xyz.Jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgData = new byte[fs.Length + 1];
    imgData = br.ReadBytes(Convert.ToInt32((fs.Length)));
    drRow[0] = imgData;
    dtTable.Rows.Add(drRow);
    br.Close();
    fs.Close();
    br = null;
    fs = null;
    CrystalReportId rptobj = new CrystalReportId();
    rptobj.SetDataSource(dtTable);
    CrystalReportViewerCrystalReportId.ReportSource = rptobj;


Sign In to post your comments