Hello I have got this line of code to load the image from Sql Database:
MemoryStream mem;
void zobraz_logo()
{
try
{
SqlDataAdapter dataAdapter = new SqlDataAdapter(new SqlCommand("SELECT logo FROM firma WHERE id = 1", spojeni));
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
if (dataSet.Tables[0].Rows.Count == 1)
{
Byte[] data = new Byte[0];
data = (Byte[])(dataSet.Tables[0].Rows[0]["logo"]);
mem = new MemoryStream(data);
}
}
catch (Exception)
{
MessageBox.Show("");
}
}
Now I'm trying to pass it as parameter to ReportViewer:
eportParameter[] parameter = new ReportParameter[18];
parameter[18] = new ReportParameter("rp_logo", Image.FromStream(mem)); // this is the issue line
this.firmaTableAdapter.Fill(this.dataset_voucher.firma);
this.zajezdTableAdapter.Fill(this.dataset_voucher.zajezd,vybrana_akce,klientClass.Rocnik());
this.reportViewer1.LocalReport.SetParameters(parameter);
this.reportViewer1.RefreshReport();
}
I'm trying to load image as parameter to Image of the ReportViewer I hope it is possible do it this way. If not May you please propose me the best way to do that?
On the mentioned line I'm receiving error: Argument 2:cannot convert from System.Drawing.Image to String[]
Thank you for your time.