如何直接加载在固定路径的图片(文件)到数据库中? http://www.csdn.net/expert/topic/651/651112.xml?temp=.8826715 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.IO.FileStream fs = new System.IO.FileStream("file path and name", IO.FileMode.Open, IO.FileAccess.Read);byte[] imgData = new byte[fs.Length];fs.Read(imgData, 0, fs.Length);SqlConnection conn = new SqlConnection("...");SqlDataAdapter da = new SqlDataAdapter("select ... ", conn);DataSet ds = new DataSet();da.Fill(ds);SqlCommandBuilder cb = new SqlCommandBuilder(da);ds.Tables[0].Rows[0]["img"] = imgData;da.Update(ds);其中,img字段为Image类型。 请教一个ASP.NET+AJAX异常处理的问题! 逻辑包的设计 怎么用Ajax(除了使用Ajax控件以外) Server.Transfer怎么用? 有没有一套很实用的用户权限设计方法? javascript包含文件为什么会不认汉字? 簡單的HtmlTable的問題 这是什么原因?奇怪,高手请进! silverLight调试出错 网站做好了,怎么把它放到服务器上去,急,马上结贴! 关于asp.net的配置问题 请问,在datagrid控件中怎样才能实现编辑呢?
byte[] imgData = new byte[fs.Length];
fs.Read(imgData, 0, fs.Length);
SqlConnection conn = new SqlConnection("...");
SqlDataAdapter da = new SqlDataAdapter("select ... ", conn);
DataSet ds = new DataSet();
da.Fill(ds);
SqlCommandBuilder cb = new SqlCommandBuilder(da);
ds.Tables[0].Rows[0]["img"] = imgData;
da.Update(ds);
其中,img字段为Image类型。