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?