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")

Recommended Answers

All 2 Replies

Do u get any error, if yes then please post it here...

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.