请问在C#中怎样将保存在数据库中的二进制下载到本地还原(DLL)? 直接使用ADO读出来二进制数据流然后保存为xx.dll文件.ok 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果要动态执行的话,看看System.Reflection.Emit 作个下载页面啰 和下载图片差不多<%@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"];//"server=localhost;database=pubs;uid=sa;pwd=;" 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> 关于此功能的实现 C# 数据采集类的应用程序,数据显示的有关问题。 关于c#开发pda的问题!! C# 不懂的语法结构求高手,在线等 请问datagridview绑定后怎么排序 richtextbo用 AppendText加东西,怎么会儿就没有反应了呢? 如何制作无边框按钮 關於數據類型的問題(有關于代碼生成的問題) 求助:如何使用C#编写dll? Web TreeView控件问题 不同数据库的数据交换问题! 用过CheckedListBox的朋友请帮忙
和下载图片差不多<%@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"];
//"server=localhost;database=pubs;uid=sa;pwd=;"
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>