A
Anitha
Hi All,
How to retrieve images stored in Access database.
I am storing images(jpeg) as OleObject.
I want display them on my web page.
I am unable to do so.Please help me I am using C#
The code is as
// Put user code to initialize the page here
int ImgID = System.Convert.ToInt32(Request.QueryString["ImgID"]);
System.Data.OleDb.OleDbConnection Con = new
System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\images.mdb;");
System.String SqlCmd = "SELECT Image FROM Images";
System.Data.OleDb.OleDbCommand OleDbCmdObj = new
System.Data.OleDb.OleDbCommand(SqlCmd, Con);
Con.Open();
System.Data.OleDb.OleDbDataReader OleReader =
OleDbCmdObj.ExecuteReader();
while(OleReader.Read())
{
Response.ContentType = "IMAGE/JPEG";
Response.BinaryWrite( (byte[])OleReader["Image"]);
}
Response.End();
Tahnks,
Anitha
How to retrieve images stored in Access database.
I am storing images(jpeg) as OleObject.
I want display them on my web page.
I am unable to do so.Please help me I am using C#
The code is as
// Put user code to initialize the page here
int ImgID = System.Convert.ToInt32(Request.QueryString["ImgID"]);
System.Data.OleDb.OleDbConnection Con = new
System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\images.mdb;");
System.String SqlCmd = "SELECT Image FROM Images";
System.Data.OleDb.OleDbCommand OleDbCmdObj = new
System.Data.OleDb.OleDbCommand(SqlCmd, Con);
Con.Open();
System.Data.OleDb.OleDbDataReader OleReader =
OleDbCmdObj.ExecuteReader();
while(OleReader.Read())
{
Response.ContentType = "IMAGE/JPEG";
Response.BinaryWrite( (byte[])OleReader["Image"]);
}
Response.End();
Tahnks,
Anitha