Link to home
Create AccountLog in
Avatar of Reklaw
Reklaw

asked on

MySQL - VB.NET - MD5

I'm sure this is going to be an "it's easy when you know how..." but here goes.

If I run this on a MySQL command line I get what I expect:
mysql> SELECT MD5('test text') AS strMD5;
+----------------------------------+
| strMD5                        |
+----------------------------------+
| 1e2db57dd6527ad4f8f281ab028d2c70 |
+----------------------------------+
1 row in set (0.00 sec)

However if I do this:
            strSQL = "SELECT MD5('test text') AS strMD5"
            objSQLCommand.CommandText = strSQL
            objDataAdapter = New MySqlDataAdapter()
            objDataAdapter.SelectCommand = objSQLCommand


            objDataSet = New DataSet
            objDataSet.DataSetName = "xxxx"

            objDataAdapter.Fill(objDataSet, "yyyy")

            objDataSet.WriteXml(Response.OutputStream)

I get:
<xxxx>
  <yyyy>
    <strMD5>MWUyZGI1N2RkNjUyN2FkNGY4ZjI4MWFiMDI4ZDJjNzA=</strMD5>
  </yyyy>
</xxxx>

Why is the result different?
Mike
ASKER CERTIFIED SOLUTION
Avatar of kraiven
kraiven

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Reklaw
Reklaw

ASKER

As I said... Easy when you know how 8-)
Many thanks to you both
Mike