c# - 从 Access 数据库的 BLOB 字段中提取信息
问题描述
我一直在使用一个名为 myphotoindex 的旧照片标记程序,并想提取我多年来创建的所有照片标记。该程序是用 C# 编写的(我从未使用过)并使用 Access 数据库。我对javascript更满意。我试图将 Access 中的数据导出到 XML 文件中,它看起来像 Base64 信息。从下面的 C# 代码中,标签看起来像是序列化的数组。如果可能的话,我只想要纯文本的数组信息。非常感谢任何不涉及 C# 编程的帮助。
if ((reader.IsDBNull(((int)(ImageDataSourceColumnId.ImageTags))) == false)) {
byte[] byteArray = new byte[reader.GetBytes(((int)(ImageDataSourceColumnId.ImageTags)), 0, null, 0, Int32.MaxValue)];
if (((byteArray != null)
&& (byteArray.Length > 0))) {
reader.GetBytes(((int)(ImageDataSourceColumnId.ImageTags)), 0, byteArray, 0, byteArray.Length);
MemoryStream ms = new MemoryStream(byteArray);
BinaryFormatter bf = new BinaryFormatter();
try {
object intArrray = bf.Deserialize(ms);
imageData.AddTags(((int[])(intArrray)));
}
catch (ArgumentNullException ex) {
Logger.Log(ex);
imageData.ClearTags();
}
catch (SerializationException ex) {
Logger.Log(ex);
imageData.ClearTags();
}
catch (SecurityException ex) {
Logger.Log(ex);
imageData.ClearTags();
}
}
}
解决方案
推荐阅读
- android - 我可以保留密码的未加密内存副本吗?
- python - with 块中多个 __exit__ 调用的顺序是否总是确定的?
- julia - 内置 Flux.jl 方法来获取 NaN
- r - R中带有pca.robust的自动绘图功能
- javascript - 根据范围计数和过滤项目
- javascript - setInterval & setTimeout 在错误的时间执行
- arrays - 在 Firestore 中更新我的文档字段时遇到问题
- php - 注销并更新mysql数据库
- flutter - 如何在飞镖中等待 Map.forEach()
- ansible - 稳定 | 将键附加到列表中的每个字典