Please tell me how to save and show Richtextbox's data in database and retrive it in saved format and which datatype should be used to save that data. i am using vb.net and MY SQL
Asked
Active
Viewed 1,999 times
3 Answers
3
if your data contains image/icons or some special symbols then its better to go for BLOB otherwise you can go with varchar datatype.

Ashok Bishnoi
- 199
- 13
1
You can use the BLOB datatype.

UnDiUdin
- 14,924
- 39
- 151
- 249
-
how to save and retrive... ? should i use richtextbox1.rtf ? – Dr. Rajesh Rolen Jun 16 '10 at 07:41
-
here there is an example on how to insert an image, just adapt to save the rtf: http://forums.mysql.com/read.php?38,6172,15703 – UnDiUdin Jun 16 '10 at 08:17
0
Your RTF Data feild should be "Memo".
private void InsertToMemo()
{
using (OleDbConnection oleDbConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\AD.mdb"))
{
OleDbCommand oleDbCmd = new OleDbCommand("insert into Table2 values(1,'" + this.richTextBox1.Rtf + "')", oleDbConn);
oleDbCmd.Connection.Open();
oleDbCmd.ExecuteNonQuery();
}
}
private void ReadFormMemo()
{
using (OleDbConnection oleDbConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\AD.mdb"))
{
OleDbCommand oleDbCmd = new OleDbCommand("select Field1 from Table2", oleDbConn);
oleDbCmd.Connection.Open();
OleDbDataReader oleDbDataReader = oleDbCmd.ExecuteReader();
oleDbDataReader.Read();
this.richTextBox2.Rtf = oleDbDataReader.GetString(0);
}
}

webmonkey
- 1,083
- 1
- 15
- 33

Hemraj Patel
- 1
- 1