如何从数据库中读取图象 HOW TO: Read and Write BLOB Data by Using ADO.NET with Visual C# .NEThttp://support.microsoft.com/default.aspx?kbid=309158 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@Page language="C#"%><%@import namespace="System.Data"%><%@import namespace="System.Data.SqlClient"%><script language="C#" runat="server">public void Page_Load(Object o, EventArgs e){ int ImgID = Convert.ToInt32(Request.Params["id"]); string connStr = ConfigurationSettings.AppSettings["ConnectionString"]; SqlConnection conn = new SqlConnection(connStr); string sql = "select * from t_imgs where id = @ImgID"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@ImgID", SqlDbType.Int).Value = ImgID; conn.Open(); SqlDataReader read = cmd.ExecuteReader(); read.Read(); Response.ContentType = (string)read["type"]; Response.OutputStream.Write((byte[])read["imgData"], 0, (int)read["imgSize"]); Response.End(); conn.Close();}</script> HOW TO: Copy a Picture from a Database Directly to a PictureBox Control with Visual C#http://support.microsoft.com/default.aspx?kbid=317701 谁好心告诉我这是神马控件~~~~ 如何用C#代码打开资源管理器并定位到指定的目录 一个项目里面如何把指定的窗体生存时自动生存DLL 请问这个结果是怎么得出的? gridview问题 请大家帮忙 如何给字符串加上划线和下划线?? vs2005中怎样做右键菜单。 插入成功后,值是问号,数据库是oracle 这个正则我 怎么都写不好 今天高兴散分了! 有没有什么办法能把C#写的东西直接编译成机器码??? 请问COM+。。。。。
<%@import namespace="System.Data"%>
<%@import namespace="System.Data.SqlClient"%>
<script language="C#" runat="server">
public void Page_Load(Object o, EventArgs e)
{
int ImgID = Convert.ToInt32(Request.Params["id"]);
string connStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(connStr);
string sql = "select * from t_imgs where id = @ImgID";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add("@ImgID", SqlDbType.Int).Value = ImgID;
conn.Open();
SqlDataReader read = cmd.ExecuteReader();
read.Read();
Response.ContentType = (string)read["type"];
Response.OutputStream.Write((byte[])read["imgData"], 0, (int)read["imgSize"]);
Response.End();
conn.Close();
}
</script>
http://support.microsoft.com/default.aspx?kbid=317701