I want to add the Variables userName and encryptedPass to column 1 and 2 on the Users Table of my "SongRater" database. The database is set up and functional. I've tried a few solutions but haven't found any that work for my specific situation.
private void button4_Click_1(object sender, EventArgs e)
{
//ensures passwords match
if (textBox4.Text == textBox5.Text)
{
//encrypts password using username as key
string userName = textBox3.Text;
string passToEncrypt = textBox4.Text;
VignereCipher v = new VignereCipher();
string s0 = passToEncrypt;
string pw = userName;
string encryptedPass = v.encrypt(s0, pw, 1);
//adds username and encrypted password to SQL database
//not sure what to do here
//confirms user added and closes user create form
MessageBox.Show("user successfully added!");
this.Close();
}
else
{
MessageBox.Show("Password does not match confirmed password");
}
}
the SQL Table is here, and again the database name is "SongRater". I know how to use SQL to add records to a database, which is all I'm trying to do here (also setup the UserID value to increase by one for each user in the table)
CREATE TABLE Passwords
(
UserID INT IDENTITY(1,1) PRIMARY KEY,
UserName VARCHAR(15) NOT NULL,
ScrambledPass VARCHAR(25) NOT NULL,
)
I want to add C# string userName
to the userName
column, and add C# string encryptedPass
to the ScrambledPass
column. Any recommended resources on how to do this using the windows form button would be greatly appreciated, or any quick solutions.