Hi, i'm trying to convert a Byte[] to byte.
this is what i have, but it does not work
FileStream
fsReport = new FileStream(reportPath, FileMode.Open, FileAccess.Read);
Byte[] bytBLOBData = new Byte[fsReport.Length];
fsReport.Read(bytBLOBData, 0, bytBLOBData.Length);
fsReport.Close();
//Convert Byte[] to string
String temp = "";
--> I tried encoding with both ASCII and Unicode
//System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
System.Text.
UnicodeEncoding enc = new System.Text.UnicodeEncoding();
temp = enc.GetString(bytBLOBData);
//Convert String ToolBar byte
try
{
r.reportfile =
Byte.Parse(temp);
}
catch (FormatException ex)
{
MessageBox.Show(ex.ToString());
}
But then i get the message when attempting to execute the Byte.Parse(temp) : input string is not in the correct format.
Can anyone guide me into the right direction