如何使用fileupload控件在sql数据库中存储图像并将其显示在gridview中 [英] How to store image in sql database using fileupload control and display it in gridview

查看:125
本文介绍了如何使用fileupload控件在sql数据库中存储图像并将其显示在gridview中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sql数据库中有一个Employee表,我想使用 FileUpload Control在表中添加Employee Image ,然后在gridview中显示该图像。那么我怎么能做到这一点。 Plz帮助。

I have one Employee table in sql database, I want to add Employee Image in the table using FileUpload Control and then display that image in gridview. So how can i achive this. Plz help.

推荐答案

用Google搜索?

您可以通过

执行此操作1.在文件系统中保存图像它在DB中的路径

2.在DB中保存图像(当你有更多的记录时,它占用了DB中的大量空间)

参考这里:

http://aspsnippets.com/Articles/Upload-images-to-folder-and-display-uploaded-images-in-ASPNet-GridView-using-C-and-VBNet.aspx [<一个href =http://aspsnippets.com/Articles/Upload-images-to-folder-and-display-uploaded-images-in-ASPNet-GridView-using-C-and-VBNet.aspx\"target =_ blank title =新窗口> ^ ]

http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html [ ^ ]

http://www.c-sharpcorner.com/uploadfile/0c1bb2/uploading-images-to-database-using-asp-net -c-sharp / [ ^ ]

http://www.aspsnippets.com/Articles/How-to-save-insert-Image-in-Database-in- ASPNet-using-C-and-VBNet.aspx [ ^ ]
Googled?
You can do this by
1.Saving image in file system and its path in DB
2.Saving image in DB(It occupy lot of space in DB when you have more no of records)
Refer here:
http://aspsnippets.com/Articles/Upload-images-to-folder-and-display-uploaded-images-in-ASPNet-GridView-using-C-and-VBNet.aspx[^]
http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html[^]
http://www.c-sharpcorner.com/uploadfile/0c1bb2/uploading-images-to-database-using-asp-net-c-sharp/[^]
http://www.aspsnippets.com/Articles/How-to-save-insert-Image-in-Database-in-ASPNet-using-C-and-VBNet.aspx[^]


试试此链接,工作正常。



http://forums.asp.net/t/1922364.aspx [ ^ ]



如果你想将图像文件存储在网络服务器中并将图像路径保存在Db中你可以更喜欢这个链接

http://www.aspsnippets.com/Articles/Retrieve-images-using-a-file-path-stored-in-database -in-ASPNet.aspx [ ^ ]





它更好将图像存储在Web服务器而不是SQL服务器中并将文件路径保存在表列中,如果要处理更多图像,

如果图像数量较少,可以将图像对象保存在SQL Server。
Try this link, works fine.

http://forums.asp.net/t/1922364.aspx[^]

If you wanna store the image file in web server and save the image path in Db you can prefer this link
http://www.aspsnippets.com/Articles/Retrieve-images-using-a-file-path-stored-in-database-in-ASPNet.aspx[^]


Its better to store the images in web server instead of SQL server and save the file path in table column, if you are handling more number of images,
in case of less number of images you can save the image object in the SQL Server.


将SQL表的字段数据类型设置为Binary,因为您要存储大文件i。 e.BLOB(二进制大对象)
Make the field datatype of your SQL table as Binary because your going to store large file i.e. BLOB (Binary Large Object)


这篇关于如何使用fileupload控件在sql数据库中存储图像并将其显示在gridview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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