Declarar byte[] objData
fuera y antes de usar bloque e intente establecer tamaño de matriz de bytes:
byte []objData=null;
using (MemoryStream memStream = new MemoryStream())
{
using (FileStream fileStream = File.Open(txtDICOMFilePath.Text, FileMode.Open))
{
fileStream.CopyTo(memStream);
}
int intL = Convert.ToInt32(memStream.Length);
objData = new byte[intL];
memStream.Read(objData,0,objData.Length);
}
SqlCom.Parameters.Add("@ImageData",SqlDb.Image,objData.Length).Value=objData;
EDITAR:para leer datos de ImagesStore
string qry = "select * From ImagesStore";
using(SqlConnection Cn=new SqlConnect(CnStr))
{
using(SqlCommand SqlCom = new SqlCommand(qry, CN))
{
Cn.Open();
using(SqlDataReader dr=SqlCom.ExecuteReader())
{
while(dr.Read())
{
string path="x:\\folder\\" + dr[0] + ".png";
byte []bytes=(byte[])dr[1];
System.IO.File.WriteAllBytes(path,bytes);
}
}
}
}
Alternativamente, puede usar DataAdapter/DataTable (código en OP)
if (dt.Rows.Count > 0)
{
foreach(DataRow row in dt.Rows)
{
string path="x:\\folder\\" + row[0] + ".png";
byte []bytes=(byte[])row[1];
System.IO.File.WriteAllBytes(path,bytes);
}
}