Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


VB6 - MySql Import Text or blob into Rich Text box

VB6 - MySql Import Text or blob into Rich Text box

VB6 - MySql Import Text or blob into Rich Text box

Hi All,

I am relatively new to VB6 and MySQL. I am trying to display a TEXT or Blob field stored in a MySQL database into a Rich Text box on a form. I then want to be able to make changes to this Rich text field and save the changes to the database. I am hoping that I am missing something obvious, because when I save the RTB data into the MySQL db as rtf, it converts that data in the field so that it is un-readable. Loading this altered data in, does not convert it back to rich text, as I had hoped. I expected it to convert the data, but how am I supposed to be able to read it back in?

Here's what I have...

Private Sub Form_Load()
Dim str As String
Dim rsItem As ADODB.Recordset
Dim Conn As ADODB.Connection
    Set Conn = New ADODB.Connection
    Conn.Open "DSN=dsnValue;SERVER=server;DATABASE=test", "user", "pswd"
    Set rsItem = New ADODB.Recordset
    str = "Select * from RTB_test;"
    rsItem.CursorType = adOpenKeyset
    rsItem.LockType = adLockOptimistic
    rsItem.Open str, Conn, , , adCmdText
    With rsItem
        RichTextBox1.TextRTF = rsItem!Data1
    End With
    Set rsItem = Nothing
    Set Conn = Nothing
End Sub

The Save is set up the same way...

rsItem!Data1 = RichTextBox1.TextRTF

This is saving the data out as : "TÆy"
instead of "{\rtf1\ansi\...."

Can anyone help me and tell me what I am missing? The data I am storing will exceed the 255 character limit for a varchar, which is why I am trying to use something that should be able to accommodate more. Thank you!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close