473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Save Rtf from a RichTextBox into Access

Fab
Hi,

How can I save the text edited in a richTextBox into a field of an Access
table.
I have an error using the following code:

OleDbCommand toto = new OleDbCommand("UPDATE Table1 SET Field1 = '" +
richTextBox1.Rtf.Replace("'","''").Trim() + "' WHERE id = 8"
toto.ExecuteNonQuery.

Field1 is a Memo type.

Thanks !
Nov 29 '06 #1
3 3371
Hey Fab

You'll be saved a lot of grief if you used parameterized queries. Try
this:

OleDbCommand toto = new OleDbCommand("UPDATE Table1 SET Field1 = ?
WHERE id = 8");

toto.Parameters.Add(new OleDbParameter("@Field1",richTextBox1.rtf))


On Wed, 29 Nov 2006 22:04:58 +0100, "Fab" <no**@none.comwrote:
>Hi,

How can I save the text edited in a richTextBox into a field of an Access
table.
I have an error using the following code:

OleDbCommand toto = new OleDbCommand("UPDATE Table1 SET Field1 = '" +
richTextBox1.Rtf.Replace("'","''").Trim() + "' WHERE id = 8"
toto.ExecuteNonQuery.

Field1 is a Memo type.

Thanks !
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 29 '06 #2
Fab
Thanks that works perfectly !
Nov 30 '06 #3
Awesome!

On Thu, 30 Nov 2006 11:41:19 +0100, "Fab" <no**@none.comwrote:
>Thanks that works perfectly !
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Maya | last post by:
Hey, there! I'm new to vb.net and it seems I wouldn't be able to solve this without help. I have a pipe delimited file that has to be saved in txt format so it could be accepted by my DTS...
1
by: Yuelin | last post by:
Hi there How can I read a RTF file into a RichTextBox control without the original format being lost? And how can I save the text entered in a RichTextBox into a RTF file without the original...
1
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
3
by: Tom Sweet | last post by:
Hi I know how to use the bitmap and graphics objects to create bitmaps and write text on them with the drawString method. I now need to create some BMPs of word or RTF docs. What would be the...
1
by: txomin | last post by:
Hi all, Following the instructions of this link http://support.microsoft.com/kb/812425, i've been able to print the content of a RichTextBox control . Apart from that , I want to have the chance...
1
by: ooroboo | last post by:
i wont have made a simple program for my self , with 2 tabs a text document and a web browser , i have had a little look and could not find a way to open a Save As dialog for my Richtextbox is this...
1
by: Ang | last post by:
Hi, How can I save two richtextbox contents into a file? if simply join two richtextboxes like joining two string, the output file will not show the value of second richtextbox. Thanks for...
1
by: Andrus | last post by:
I need to save font selected by user by Ctrl+MouseWheel in Winforms RichTextBox. I tried override below but this does not remember font: in this method Font.Size property seems to be always...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.