我正在使用OleDbDataReader rdr
将 BLOB 形式的“评论”字段(sub_type 1 段大小 80)读取到来自 Interbase DB 的字符串中,并且我不断收到异常。有什么建议么?
尝试#1
ls_Chap_Comments.Add((rdr["Comments"]).ToString());
InvalidCastException:由于符号不匹配或数据溢出以外的原因,无法转换数据值。例如,数据存储中的数据已损坏,但该行仍可检索。”
尝试#2
byte[] b = new byte[100];
b = (byte[])rdr["Comments"];
string s = System.Text.ASCIIEncoding.ASCII.GetString(b);
InvalidCastException:无法将类型的对象转换System.String
为类型System.Byte[]
尝试#3
// 17 is the BLOB column zero-based location for "Comments"
retval = rdr.GetBytes(17, startIndex, outbyte, 0, bufferSize);
InvalidCastException:无法将类型的对象转换System.String
为类型System.Byte[]
。
任何建议将不胜感激!