0

What I am trying to do? update a database field with a richtextboxfield.

Please help.

I have tried using Dim range1 As New System.Windows.Documents.TextRange(RichTextBox1.Document.ContentStart, RichTextBox1.Document.ContentEnd)

but this did not work for me either.

Dim cnn As SqlConnection
        Dim connectionString As String


        connectionString = "Integrated Security=SSPI;Initial Catalog=rploperations;Data Source=" & Environment.MachineName.ToString
        cnn = New SqlConnection(connectionString)
        cnn.Open()

        Dim CMD As New SqlCommand
        CMD.Connection = cnn
        Dim esgnotes As String
        esgnotes = textbox1.text '''''I want to change to Richtextbox1.text(but this does not exist)
        MsgBox(esgnotes)
        CMD.CommandText = "Update [rplESGnotes] set notes = " & "'" & esgnotes & "'"

        CMD.ExecuteNonQuery()

        MsgBox(ComboBox1.Items(ComboBox1.SelectedIndex).ToString() & " has been updated")
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by M.Waqas Aslam
0

i dont know the reason why this is happening , to trace error , please use try catch block , and for now you can use textbox with multiline true property , to save huge text.
Regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.