Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

VB6 - MySql Import Text or blob into Rich Text box

kiki13 (TechnicalUser)
10 Apr 09 17:11
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
        rsItem.MoveFirst
        RichTextBox1.TextRTF = rsItem!Data1
    End With
    
    rsItem.Close
    Set rsItem = Nothing
    Conn.Close
    Set Conn = Nothing
End Sub

The Save is set up the same way...

rsItem!Data1 = RichTextBox1.TextRTF
.Update

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!!
 

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