Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将图像从 Image Control 保存到 SQL Server?我没有上传该图像,而是通过网络摄像头捕获它并将其显示在图像控件上。
假设您需要保存图像本身,而不是路径,您可以这样做:
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); byte[] image = br.ReadBytes((int)fs.Length);
然后,将字节发送到您的数据库。