sorry for my english
this example it's for access but you can convert to sql server
<script runat="server" Language="C#">
void Page_Load(Object o,EventArgs e) {
string db, strsql, idx;
idx = Request.QueryString["id"];
if (idx = =null) idx = "1";
db="immagini.mdb";
OleDbConnection myconnection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="+Request.MapPath(db));
myconnection.Open();
strsql = "Select image,name,contenttype FROM Tabella1 where id=" + idx;
OleDbCommand mycommand = new OleDbCommand(strsql,myconnection);
OleDbDataReader re = mycommand.ExecuteReader();
if (re.Read()) {
Response.Clear();
Response.ClearContent();
Response.ContentType = re["contenttype"].ToString();
Response.BinaryWrite((byte[])re["image"]);
}
else
Response.Write ("nothing image for this ID");
re.Close();
myconnection.Close();
}
</script>
in the page:
<img src="view_image.aspx?id=1">
good luck
byez
imperugo (exCartman)
myblog :
http://imperugo.blogspot.com
Johnny Emde said:
Hello
I'am building an web application that enable users to get data stored in
a SQL Server.
My problem is pictures. How can I display pictures stored in SQL Server -
In the old days, I took the picture and saved it into disk and loaded
from here...
Kind regards
Johnny E Jensen