int ArraySize = new int();
bool bReturnvalue = false;
byte[] byteData = new byte[0];
SQLConnection con=new SQLConnection("Connectionstring");
try
{
SQLCommand cmd=new SQLCommand("select query to get byte data",con);
byteData = (byte[])cmd.ExecuteDataScalar();
if (byteData != null)
{
if (byteData.Length == 0)
bReturnvalue = false;
else if (byteData.Length > 0)
{
ArraySize = byteData.Length; // Track# 83710
FileStream fs = new FileStream(sDestination, FileMode.Create, FileAccess.Write);
fs.Write(byteData, 0, ArraySize);
fs.Close();
bReturnvalue = true;
}
}
}
catch (Exception ex)
{
throw new Exception(ex);
}
Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator