Dear Daniweb Team

I am new to vb.net and doing some experiments with it. Trying to make a small application for personal use.

I have some WORD files, which are formatted using bold, italic and colors etc. I want to copy entire content of word file into SQL Server table using Visual Basic.NET.

I have a RichTextBox on my form and used datatype nvarchar(max) to store Unicode Hindi data. Everything is working fine... data insert and retrieve is OK, but formatting is GONE.

Please guide me, so that I can solve this issue.

Below is the code to insert.

cmd.CommandText = "Update tbl_Camps SET CampName = '" & StrConv(Trim(txtCampName.Text), VbStrConv.ProperCase) & "', CampVenue = '" & StrConv(Trim(txtCampVenue.Text), VbStrConv.ProperCase) & "', CityID = '" & cboCity.SelectedValue & "', FromDate = '" & Format(dtpFromDate.Value.Date, "dd-MMM-yyyy") & "', ToDate = '" & Format(dtpToDate.Value.Date, "dd-MMM-yyyy") & "', LiveDVpkt = '" & txtDVpkt.Text & "', [B]CampNotes = N'" & rtbCampNotes.Text & "'[/B] Where CampID = '" & frmMain.lblCampID.Text & "'"

Try this

CampNotes = N'" & rtbCampNotes.Rtf.Replace("'","''") &

The Rtf property contains the source for formatting the text. The Replace ("'","''") will prevent SQL injection if any "'" exists in the text.

Hope this helps.