I've noticed that a string I stored into SQL server does not appeare to be the same as the orginal string.
If I have the string "Œ‘•" and store it into the database field that is of type varChar, then I read the string and get the value: "O_'¤". I'm using the VB code bellow.
Can someone please explain why the string is converted, and what I shall do to get the exact string stored in the database without this unexpected conversion.
Regards
LeChuck
Dim rst As New ADODB.Recordset
Dim sBeforeStored As String
Dim sReadFromSQL As String
Dim i As Integer
sBeforeStored = Chr(140) & Chr(141) & Chr(145) & Chr(149) & Chr(15)
'Store the string in the SQL server.
rst.Open "SELECT * FROM myTable", myConnection
rst.AddNew
rst("myColumn" = sBeforeStored
rst.Update
rst.Close
'Reads the string from the SQL server.
rst.Open "SELECT * FROM myTable"
sReadFromSQL = rst("myColumn"
For i = 1 To Len(sReadFromSQL)
MsgBox "sBeforeStored: " & Asc(Mid(sBeforeStored,i,1)) & vbCrLf & "sReadFromSQL: " & Asc(Mid(sReadFromSQL,i,1))
Next i
rst.close
If I have the string "Œ‘•" and store it into the database field that is of type varChar, then I read the string and get the value: "O_'¤". I'm using the VB code bellow.
Can someone please explain why the string is converted, and what I shall do to get the exact string stored in the database without this unexpected conversion.
Regards
LeChuck
Dim rst As New ADODB.Recordset
Dim sBeforeStored As String
Dim sReadFromSQL As String
Dim i As Integer
sBeforeStored = Chr(140) & Chr(141) & Chr(145) & Chr(149) & Chr(15)
'Store the string in the SQL server.
rst.Open "SELECT * FROM myTable", myConnection
rst.AddNew
rst("myColumn" = sBeforeStored
rst.Update
rst.Close
'Reads the string from the SQL server.
rst.Open "SELECT * FROM myTable"
sReadFromSQL = rst("myColumn"
For i = 1 To Len(sReadFromSQL)
MsgBox "sBeforeStored: " & Asc(Mid(sBeforeStored,i,1)) & vbCrLf & "sReadFromSQL: " & Asc(Mid(sReadFromSQL,i,1))
Next i
rst.close