Get user name from one form to another
access rights
I have error in line 28
{"Invalid column name 'a'."}
a is username and pasword
- private static int korisnikId;
- private static int korisnickaGrupa;
- private string korisnickoIme;
-
- public void findsUserName()
- {
- SqlConnection myConnection = new SqlConnection(cs);
- String command = "SELECT ime_prezime FROM osobe_korisnici where id = \"" + korisnikId + "\"";
-
- SqlCommand myCommand = new SqlCommand(command, myConnection);
-
-
- myCommand.Connection.Open();
- this.korisnickoIme = myCommand.ExecuteScalar().ToString();
- }
-
- private void prijava()
- if (korisnikId > 0)
- {
- command = "SELECT osobe_korisnici.lozinka FROM osobe_korisnici where osobe_korisnici.id = " + korisnikId;
- SqlCommand myCommand2 = new SqlCommand(command, myConnection);
- String lozinka = myCommand2.ExecuteScalar().ToString();
- if (lozinka == lozinkaTextBox.Text)
- {
- command = "SELECT korisnik_grupa.redni_broj FROM korisnik_grupa where korisnik_grupa.broj_grupe = \"" + korisnikId + "\"";
-
- SqlCommand myCommand3 = new SqlCommand(command, myConnection);
- korisnickaGrupa = Int32.Parse(myCommand3.ExecuteScalar().ToString());
-
- if (korisnickaGrupa == 1)
- {
- findsUserName();
- DialogResult = DialogResult.OK;
- }
- else
- {
- errorLabel.Text = "You dont have acces for this app";
- }
- }
- else
- {
- errorLabel.Text = "Wrong password";
- }
- }
- else
- {
- errorLabel.Text = "Wrong user name";
- }
-
-
- }