Hi there,
I have a question in EncryptByPassPhrase.
I am trying to encrypt the source column in the database table PForm. When I run the code it sasys, “Failed to convert parameter value from a String to a Byte[].”
the SourcePath column in the database is varBinary(256) type.
What is the problem over here.
public void AddFormDetails(string ID, string SourcePath)
{
string query = @"Insert into PForm(ID, SourcePath)
Values(@id,EncryptByPassPhrase('AdminApplication',@source)";
SqlCommand command = new SqlCommand(query, DB.getConnection());
command.Parameters.Add("@id", SqlDbType.VarChar).Value = ID;
command.Parameters.Add("@source", SqlDbType.VarBinary).Value = SourcePath ;
db.openConnection();
command.ExecuteNonQuery();
db.closeConnection();
}