Hi,
You have to extract it, save it to disk and then serve it, the code below
does that, please note that they are pieces of code, so it will not work as
is
It's just to give you an idea
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
protected override void Load()
{
saved = true;
//generate a new local name for this file
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "LoadDocument";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dID", SqlDbType.Int).Value = id;
SqlDataReader reader = DataProvider.ExecuteReader( cmd);
while( reader.Read() )
{
this.comment = "";
this.origname = reader["OrigName"].ToString();
this.dDate = Convert.ToDateTime( reader["dDate"]);
//Now we have to save the image
this.name = Guid.NewGuid().ToString() + "." + origname.Substring(
origname.LastIndexOf(".")+1);
physicalname = physicalname + @"\" + name;
ExtracFileFromDB( reader);
}
reader.Close();
}
protected void ExtracFileFromDB( SqlDataReader reader)
{
FileStream file = new FileStream( physicalname, FileMode.Create);
file.Write( (byte[])reader["Data"], 0,
((byte[])reader["Data"]).GetUpperBound(0)+1 );
file.Close();
}
msuk said:
All,
I have a blob image (jpeg) in a sql server table and would like to display
it within my datagrid on my ASP.Net C# web form is this possible and how?
Thanks
Msuk