- private void UserInputKeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter) //only accepts enter key
- {
- string dbconnection = ConfigurationManager.ConnectionStrings["OverwatchDatabase"].ConnectionString;
- SqlConnection connection = new SqlConnection(dbconnection);
- connection.Open();
- if (connection.State == ConnectionState.Open)
- {
- MessageBox.Show("You have been successfully connected to the database!");
- SqlCommand Password_Hash = new SqlCommand("SELECT Password_Hash" + "From dbo.Authorized_Personnel", connection); //Password_Hash is the column name and Authorized_Personnel is the tables name
- bool Authenticate = BCrypt.Net.BCrypt.Verify(UserInput.Password, Password_Hash); //UserInput.Password is the password box on my wpf application
- if (Authenticate == true)
- {
- MessageBox.Show("Authentication Successful");
- connection.Close(); //closes the connection to database
- mainscreen = new MainScreen();
- mainscreen.Show();
- this.Close();
- }
- else
- {
- MessageBox.Show("Authentication Failed");
- Application.Current.Shutdown();
- }
- }
- else
- {
- MessageBox.Show("Connection failed.");
- }
- }
- }
C# wpf bcrypt verification via sql server table
I'm having trouble authenticating against my sql server with bcrypt if anyone can help and explain what going on that would very much appreciated
its throwing an error at the moment saying cannot convert system.dat.sqlclinet.sqlcommand to string
Nitin SontakkePosted Jul 29, 2016, 5:55 AM