惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
MyScale Blog
MyScale Blog
雷峰网
雷峰网
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
V
V2EX
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
N
Netflix TechBlog - Medium
Vercel News
Vercel News
美团技术团队
人人都是产品经理
人人都是产品经理
The Cloudflare Blog

博客园 - 久久

终于找到回归CNBLOG的理由 六度空间理论(小世界理论)否定了结构洞的存在 人生真是变化无常 我的儿时理想—让世界没有乞丐 挥之不去的技术情节 告别9月 首次尝试电话营销的味道 在textbox中加入html字符 用access数据库时的相对路径设置 关于treeview的一些知识点 好久没有上来更新资料了,有点对不起自己了 初试牛刀的收获-freetextbox的应用 初试牛刀的收获-实现Web文件的上传 初试牛刀的收获-浅尝session 初试牛刀的收获_运算符比较 初试牛刀的感受_datagrid自定义分页 .net学习笔记datalist编辑模板的应用 .net学习笔记datalist产品购买实例20060602 .net学习笔记datagrid默认、自定义分页20060531
将图片直接传到数据库的方法
久久 · 2006-07-18 · via 博客园 - 久久

(将图片转换为byte类型,然后用流的方式传输,并且将imagetype也同时上载到数据库的相应字段中。)
(浏览图片的方法,设置一个图片控件,将该图片控件的imageurl设置为

"../system/image.aspx?id="+dr1["carid"].ToString(),传递图片的识别id,然后在image.aspx中的

formload中处理图片显示,用到

Response.ContentType=dr["imagetype"].ToString();Response.BinaryWrite((byte[])dr["carimage"]);)

stream imgstream;
imgstream=uploadfile1.postedfile.inputstream;
int len=uploadfile1.postedfile.contentlength;
byte[] imagedata=new byte[len];
string imguploadname=uploadfile1.postedfile.filename;
string imgcontenttype=uploadfile1.postedfile.contenttype;
string imagename=getlastindexof("\\",imguploadname);

int n=imgstream.read(imagedata,0,len)

mycommand.parameters["image"].value=imagedata
mycommand.parameters["imagetype"].value=imgcontenttype;


public string getlastindexof(string lookfor,string mystring)
{
  int strpos;
 strpos=mystring.lastindexof(lookfor);
 return mystring.substring(strpos+1);
}