Hello, i have this code to encrypt the value of a password textbox
and i'm trying to pass that value to my database with this codeCode:System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] data = System.Text.Encoding.ASCII.GetBytes(password_textBox.Text); data = x.ComputeHash(data); string encryptedpassword = System.Text.Encoding.ASCII.GetString(data);
but i get an error because the encrypted password contains the character "?"Code:string source = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=database.accdb;Mode=ReadWrite;"; string query = "Insert into users (name,password) values ('" + name_textBox.Text + "','" + encryptedpassword + "')"; OleDbConnection conn = new OleDbConnection(source); OleDbCommand cmd = new OleDbCommand(query, conn); cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); conn.Close();
is there a way to ignore what's inside query's values and just pass it to database ? or another (better) way to encrypt the textbox's text ?
i tried to put a @ but i had no luck
Code:string query = @"Insert into users (name,password) values ('" + name_textBox.Text + "','" + encryptedpassword + "')";




Reply With Quote