If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > UTF8 Text - MyODBC

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-04, 10:10
Abattoir_JW Abattoir_JW is offline
Registered User
 
Join Date: Nov 2004
Posts: 1
Unhappy UTF8 Text - MyODBC

Hi,

I am trying to write UTF-8 text to my database, using VBA with MyODBC. My program has no problems until it encounters any data with non-ASCII text.

The string contains a "less-than-or-equal" sign, code 8806. I can save the string to a file, and open it up with no problems. The character has not been corrupted.

When I try to write the data to the database, I get a "multi-step operation generated errors" message. I entered it into a field manually, but when I read it back, the character has been garbled, and now has code 8240.

I am using MySQL 4.1.7, and MyODBC 3.5.1.

Here is my code:
Dim conn As ADODB.Connection
Dim RS As New ADODB.Recordset
Dim strTitle As String

'connect to MySQL server using MySQL ODBC 3.51 Driver
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=192.168.1.180;" _
& " DATABASE=patentdb;" _
& "UID=root;PWD=6aWfygIop; OPTION=3" & _
" CHARACTER SET = UTF8"

conn.Open
RS.CursorLocation = adUseClient

' strTitle gets the data to be written to the database
strTitle = GetData()

' a blank RS is opened, and the data is written to a new record
RS.Open "SELECT * FROM bibliodata WHERE 1 = 0", conn, adOpenForwardOnly, adLockOptimistic
RS.AddNew
RS.fields("InventionTitle") = strTitle ' fails here
RS.Update

Any takers?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On