如何把RichTextBox的内容保存到数据库?? 数据库中的字段设置为 string 然后直接复制 就可以如果RichTextBox.Text非常大 可能数据库字段得采用BLOB 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用BLOB字段时,如果是oracle数据库,可以去微软的网站上下一个oracle oledb的插件。 请问您,作web application 可以用richtextbox吗?您是如何用richtextbox的,能给一点代码给我看看吗?, 能帮我忙,有重谢! 谢谢各位,保存问题已经解决了,binary数据类型!现在问题是,如何从数据库中把数据取出来,在RichTextBox控件上显示! 保存到数据库的内容:byte[] b=System.Text.Encoding.Default.GetBytes(this.richTextBox1.Rtf);读取:SqlConnection con=new SqlConnection("...");string str="select 内容 from 数据库 where ...";//确保只返回一行SqlCommand comm=new SqlCommand(str,con);if (con.State==ConnectionState.Closed)con.Open();byte[] b=(byte[])comm.ExecuteScalar();MemoryStream stream=new MemoryStream(b,true);stream.Write(b,0,b.Length);this.richTextBox1.Clear();string s=System.Text.Encoding.Default.GetString(b,0,b.Length);this.richTextBox1.Rtf=@s;stream.Close(); 顺便问一下如何将BLOB字段读出到richtextbox? c# mediaplayer 播放问题 treeview 绑定数据 write 和 writebyte的区别 winform的节点显示窗体的问题 我是一个初学者,谁能帮我解决一个小问题 关于多维数组和交错数组的问题肯请指点 vs输出问题 请问c#中 如何写多线程程序? datagrid难题:一个datagrid如何绑定两张表中的内容? 如何在两点之间画个直线? 散分!贼简单问题:数据邦定 哪里有DevExpress.com的Net源码下载?急求!重分相赠
, 能帮我忙,有重谢!
byte[] b=System.Text.Encoding.Default.GetBytes(this.richTextBox1.Rtf);
读取:
SqlConnection con=new SqlConnection("...");
string str="select 内容 from 数据库 where ...";//确保只返回一行
SqlCommand comm=new SqlCommand(str,con);
if (con.State==ConnectionState.Closed)
con.Open();
byte[] b=(byte[])comm.ExecuteScalar();
MemoryStream stream=new MemoryStream(b,true);
stream.Write(b,0,b.Length);
this.richTextBox1.Clear();
string s=System.Text.Encoding.Default.GetString(b,0,b.Length);
this.richTextBox1.Rtf=@s;
stream.Close();
如何将BLOB字段读出到richtextbox?