patrickstrijdonck
Programmer
Hi All,
Im very new to C#, trying to learn, but there is something i cant get to work, im sure im doing something wrong but i cant find what, little help in the good direction is very welcome
What im trying to do, user fills in his name and password, and press sign on. then the SQL query shoud take a look at the table tblGebruikers and get that name and its password. put that password in a string and later(which is not in code) and if condition checks if String and textBox1.text are same, if so, continue, if not, cancel.
Hoping someone can help me
Im very new to C#, trying to learn, but there is something i cant get to work, im sure im doing something wrong but i cant find what, little help in the good direction is very welcome
Code:
string constr = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Patrick Strijdonck\Documents\IT4.mdb";
string cmdstr = "SELECT Password = @textBox1 FROM tblGebruikers WHERE" + textBox1.Text;
OleDbConnection con = new OleDbConnection(constr);
OleDbCommand com = new OleDbCommand(cmdstr, con);
con.Open();
com.Parameters.Add("@textBox1", SqlDbType.VarChar);
com.Parameters["@textBox1"].Value = name;
con.Close();
What im trying to do, user fills in his name and password, and press sign on. then the SQL query shoud take a look at the table tblGebruikers and get that name and its password. put that password in a string and later(which is not in code) and if condition checks if String and textBox1.text are same, if so, continue, if not, cancel.
Hoping someone can help me