Re: Whilch Column Type to use?
Thanks Reggie. That worked great.
However, now I can't seem to match up encrypted data (like the password) in a query. I used the same parameter in my SELECT query command as I used in the INSERT command, but I never get a match. Here's what I'm doing:
<code>
string email = "myEmail";
string password = "myPassword";
byte[] encPwd = myBiz.EncryptPassword(password);
bool readertest = false;
MySqlConnection connect = new MySqlConnection(connectString);
MySqlDataReader reader = null;
connect.Open();
string strQuery = "SELECT pk_UserID FROM accounts_users WHERE Email = @Email AND Password = @Password;";
MySqlCommand command = new MySqlCommand(strQuery, connect);
MySqlParameter p1 = new MySqlParameter("@Email", MySqlDbType.VarChar, 255);
p1.Value = email;
MySqlParameter p2 = new MySqlParameter("@Password", MySqlDbType.Blob, 20);
p2.Value = encPwd;
command.Parameters.Add(p1);
command.Parameters.Add(p2);
try
{
reader = command.ExecuteReader();
readertest = (reader.Read());
}
catch (Exception e)
{
//do something with the exception
}
finally
{
connect.Close();
}
</code>
I'm using NUnit to test things out. My test never passes (readertest is always false).
Any suggestions?
TIA,
Michael
Subject
Written By
Posted
Re: Whilch Column Type to use?
January 17, 2005 12:17PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.