[英]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数据库中。
Here we go with some links: 这里我们有一些链接:
http://www.beansoftware.com/ASP.NET-Tutorials/Binary-Files-To-Database.aspx http://www.beansoftware.com/ASP.NET-Tutorials/Binary-Files-To-Database.aspx
http://www.beansoftware.com/asp.net-tutorials/images-database.aspx http://www.beansoftware.com/asp.net-tutorials/images-database.aspx
http://www.beansoftware.com/asp.net-tutorials/images-database.aspx http://www.beansoftware.com/asp.net-tutorials/images-database.aspx
That should get you started, code wise. 那应该使您入门,明智的编码。
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.