以下是引用片段:
String sqlStr = "select content from dp where id=" + ID; //content为dp中的BLOB字段,ID为主键
MemoryStream ms = DBClass.getBlob(sqlStr);
if (ms == null)
richTextBox.Clear();
else
...{
if (ms.Length > 0)
...{
ms.Position = 0;
try
...{
richTextBox.LoadFile(ms, RichTextBoxStreamType.RichText);
}catch...{
richTextBox.LoadFile(ms, RichTextBoxStreamType.PlainText);
}
}else
richTextBox.Clear();
}
调用setBlob
以下是引用片段:
String sqlStr = "update dp set content=:BLOB where id=" + ID;
MemoryStream ms = new MemoryStream();
richTextBox.SaveFile(ms, RichTextBoxStreamType.RichText);
if (!DBClass.SetBlob(sqlStr, ms))
...{
MessageBox.Show("保存失败");
}
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved 京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089