Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在sql server-ASP.NET中存储图像_Asp.net_Sql Server_Database_Image_Store - Fatal编程技术网

在sql server-ASP.NET中存储图像

在sql server-ASP.NET中存储图像,asp.net,sql-server,database,image,store,Asp.net,Sql Server,Database,Image,Store,如何将图像从图像控件保存到SQL Server?我没有上传该图像,但我通过网络摄像头捕获图像并将其显示在图像控制上。如果您需要保存图像本身,而不是路径,您可以执行以下操作: FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); byte[] image = br.ReadBytes((int)fs.Length); 然

如何将图像从图像控件保存到SQL Server?我没有上传该图像,但我通过网络摄像头捕获图像并将其显示在图像控制上。

如果您需要保存图像本身,而不是路径,您可以执行以下操作:

FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fs);

byte[] image = br.ReadBytes((int)fs.Length);
然后,将字节发送到数据库。

检查此项