如何在SQL Server中存储图片(MS Access接口)
继播客 #59 之后,我一直在考虑将一些图像从 MS Access DB 移动到 MS SQL Server(这是我唯一尚未迁移的部分)。 现在它们作为 OLE 对象存储在 MS Access DB 中。
但是,我不知道它们应该在 SQL Server 端存储为什么数据类型,或者如何通过接口(通过 ODBC 的 MS Access)插入它们。
Following podcast #59, I've been considering moving some images from an MS Access DB into MS SQL Server (it's the only piece I haven't migrate over yet). Right now they are stored as OLE Objects in the MS Access DB.
However, I haven't got a clue what data type they should be stored as on the SQL Server side, or how to get them inserted through the interface (MS Access via ODBC).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我会使用图像类型,并且不会使用 Access 来传输它们。 我将使用 Sql Server 导入和导出向导来完成此操作。 为此,请在 Sql Server Management Studio 中右键单击要导入的数据库,选择“任务”,然后选择“导入数据”。
I would use the image type, and I would NOT use Access to transfer them. I'd use the Sql Server Import and Export Wizard to do it. To do so, right-click the database you want to import to in Sql Server Management Studio, select Tasks, and then select Import Data.
MS SQL Server 中有多个 BLOB 类型字段用于存储二进制数据 - 但其中一些有大小限制。
如果您使用 SQL 2005 或更高版本,最佳选择是 varbinary(MAX)。 它可以存储非常大的数据块。
请注意,以 OLE 格式保存图片将来会给您带来很多问题。 当您继续前进时,请考虑将图像转换为常用的图形文件(例如 JPG)。 它将节省SQL Server的资源并提高Access的显示速度。
我建议看看 AccessImagine (http://access.bukrek.net),它会对你有帮助以避免很多关于图像的麻烦。 看看视频就知道了。
There is several BLOB-type fields in MS SQL Server for storing binary data - but some of them have size limitations.
If you use SQL 2005 or higher, the best choice is varbinary(MAX). It can store really big data pieces.
Be warned, that keeping pictures in OLE format will cause a lot of problems for you in future. While you're moving on, consider converting your images to usual graphic files (like JPG). It will save resourses of SQL Server and improve Access displaying speed.
I recommend to take a look at AccessImagine (http://access.bukrek.net), it would help you to avoid a lot of headaches about the images. Just look at video.
我们使用 Ammara (www.Ammara.com 的 DBPix 来处理捕获和显示已有 5 或 6 年了。 ActiveX 控件非常易于使用,其文档中包含完整的示例代码,而且价格实惠。
我们的团队优先将图像存储在磁盘上,并通过将其位置存储在 varchar 中来引用它们,但控件将处理这两种方法。
We have used DBPix from Ammara, www.Ammara.com for 5 or 6 years now to handle the capture and display. Very easy to use ActiveX control with complete sample code in their documentation, and affordable.
Our team preferentially stores images on disk and refers to them by storing their location in a varchar, but the control will handle both methods.
您可以尝试比较它们,这可能很有趣,因为 AccessImagine 是较新的。
You can try to compare em, it can be interesting as AccessImagine is newer one.