Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string SQLlogin()
- {
- String user = textBox1.Text;
- String pass = textBox2.Text;
- String vorname;
- String nachname;
- String usersql;
- String pwsql;
- String geld_string;
- int geld;
- String HP_full_string;
- int HP_full;
- String Def_string;
- int Def;
- String Exp_string;
- int Exp;
- String spielername;
- String email;
- String HP_string;
- int HP;
- String connectionString = "Data Source =.; Initial Catalog =syntic; Integrated Security =SSPI;";
- //// SqlCommand cmd = new SqlCommand("SELECT username,password FROM users WHERE username='" + textBox1.Text + "' and password='" + maskedTextBox1.Text + "'", lgnConnection);
- SqlConnection connection = new SqlConnection(connectionString);
- connection.Open();
- SqlCommand command = new SqlCommand();
- command.Connection = connection;
- command.CommandText = ("SELECT * FROM dbo.daten WHERE username='" + user + "' and passwort='" + pass + "'");
- SqlDataReader reader = command.ExecuteReader();
- if (reader.HasRows)
- {
- while (reader.Read())
- {
- vorname = reader["vorname"] + "";
- nachname = reader["nachname"] + "";
- usersql = reader["Username"] + "";
- pwsql = reader["Passwort"] + "";
- geld_string = reader["Geld"] + "";
- geld = Convert.ToInt32(geld_string);
- HP_full_string = reader["HP_Full"] + "";
- HP_full = Convert.ToInt32(HP_full_string);
- Def_string = reader["Def"] + "";
- Def = Convert.ToInt32(Def_string);
- Exp_string = reader["Exp"] + "";
- Exp = Convert.ToInt32(Exp_string);
- spielername = reader["spielername"] + "";
- email = reader["email"] + "";
- HP_string = reader["HP"] + "";
- HP = Convert.ToInt32(HP_string);
- if (user == usersql && pass == pwsql)
- {
- //Neue Form !
- new Form2().Show();
- this.Hide();
- }
- else if (user != usersql || pass != pwsql)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment