Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 - MySql Import Text or blob into Rich Text box

Status
Not open for further replies.

kiki13

Technical User
Feb 10, 2003
5
0
0
US
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!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top