This is an example of the Page_Load event of a page GetImage.aspx:
protected void Page_Load(object sender, System.EventArgs e)
{
// get image id
string imageId = this.Request.Params["id"];
System.Data.SqlTypes.SqlBinary image; // image from database
string sql = String.Format ("SELECT photo FROM customers WHERE
customer_id = {0}", imageId);
// get image from database
SqlConnection conn = new SqlConnection (myConnectionString);
SqlCommand com = new qlCommand (sql, conn);
conn.Open();
try
{
SqlDataReader reader = dba.RunSelect (sql);
reader.Read ();
image = reader.GetSqlBinary(0);
reader.Close ();
}
finally
{
conn.Close ();
}
if (!image.IsNull && image.Value.Length != 0)
{
// stream image down to client
this.Response.ContentType = "image/gif";
this.Response.BinaryWrite (image.Value);
}
}
You would use this page as an url for your image control in format
"GetImage.aspx?id=xx".
Eliyahu
"JuniorProgrammer" <tr****@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
Please This is queit a task av been trying to solve. Could anyone please
tell
me how to read a blob from an SQL using a dataset and stuffing this image
into the Image control of a webform.
Any suggetion that would help would be highly appreciated.
--
Iyke