在数据库中插入图像 [英] Inserting image in database

查看:63
本文介绍了在数据库中插入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想使用Asp.net,sql,c#在databse中插入图像.我也想在GridView中显示图像.请帮助我..

Hi, I want to insert image in databse using Asp.net,sql,c#. And I also want to display image in GridView. Please help me..

推荐答案

这一点都不难,但我不建议这样做.是的,将缩略图存储在数据库中,但是图像本身应该存储在外部,并且该文件的位置记录在数据库中.逻辑很简单:图像很快变大,并且数据库中的空间有限(受限程度取决于数据库和数据库版本).它还使用大量带宽直接从数据库访问图像,这可能会给数据库服务器的所有用户带来问题.

存储图像或缩略图与存储任何其他二进制项目相同:只需将数据作为参数添加到UPDATE查询的INSERT中,然后按常规执行即可.
It''s not at all difficult to do, but I wouldn''t recommend it. Store a thumbnail in a DB, yes, but the image itself should be stored outside, and the location of that file recorded in the DB. The logic is simple: Images get big very quickly, and space in a DB is limited (how limited depends on the DB, and the version of the DB). It also uses significant bandwidth to access images direct from a DB, and this can cause problems for all user of the database server.

To store an image or a thumbnail is the same as storing any other binary item: just add the data as a parameter to a INSERT of UPDATE query, and execute it as normal.



请点击以下链接找到您的解决方案:
将图像保存到SQL Server 2000数据库 [ ^ ]
使用Streded Procedures和C#.net从SQL Server存储和检索图像 [ ^ ]

祝一切顺利.
--Amit

Please follow the link below to find your solution:
Save An Image Into SQL Server 2000 Database[^]
Storing and Retrieving Images from SQL Server Using Strored Procedures and C#.net[^]

All the best.
--Amit


这篇关于在数据库中插入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆