如何在图像数据类型字段中的数据库表中保存条形码图像。

问题描述:

我想将数据库中生成的条形码图像保存到具有图像数据类型字段的表中。

I want to save generated barcode image in a database into a table with image data type field.

您需要创建位图来自 barCode 。然后将其转换为字节数组并存储在数据库中。



请在此处查看答案 - 将动态生成的条形码图像保存到ASP.Net中的数据库中 [ ^ ]。
You need to create Bitmap from the barCode. Then convert that to byte array and store in database.

See the answer here - Save dynamically generated Barcode image into database in ASP.Net[^].


考虑到性能和将来的维护,建议不要将映像直接存储在数据库中。最好将图像保存在磁盘上并将图像路径信息存储在数据库中。
Considering performance and future maintenance, it's not recommended that you store the image directly in database. It's better to save the images on disk and store the image path info in database.