简体   繁体   English

谁能说出用SQL存储图像的最佳方法是什么

[英]Can anyone tell what is the best way to store images in SQL

I would like to store images in database by converting them in to binary objects or i will store them in to a temp folder and will save the path in my database. 我想通过将图像转换为二进制对象来将图像存储在数据库中,或者将它们存储在temp文件夹中并将路径保存在数据库中。 But i am unable to do the programming so can any give me a sample code to save images in to sql database using Asp.net. 但是我无法进行编程,因此任何人都可以给我一个示例代码,以使用Asp.net将图像保存到sql数据库中。

better to store image in a folder and save the path in database, which would be much faster than saving in database. 最好将图像存储在folder并将路径保存在数据库中,这比保存在数据库中要快得多。

Note dont use datatype image, which is going to change form database itself : read this 注意不要使用数据类型图像,它会改变数据库本身的格式: 请阅读

Store the images path on DB instead of storing as Binary, because it hurts performance. 将图像路径存储在DB上而不是存储为Binary,因为这会影响性能。 In SQL server, BLOB datatypes are stored in seperate pages called LOB_data page and on data pages pointers will be linked with LOB_data page. 在SQL Server中,BLOB数据类型存储在称为LOB_data页面的单独页面中,并且在数据页面上,指针将与LOB_data页面链接。 You cannot create an index over BLOB data type also. 您也不能在BLOB数据类型上创建索引。 Hence, it adversely affects the performance. 因此,它会对性能产生不利影响。 Ideal solution would be to store the images in a shared drive and storing the image link in database. 理想的解决方案是将图像存储在共享驱动器中,并将图像链接存储在数据库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM