Am building window form application using VS2010.On my login form i collect useid
and password and then click on the login button, if validation is successful direct
users to the main form.
I want to use a Dictionary to store userid and password read from the DB.
Then close connection. i then compare the inputed values from the textbox againt values:
userd and passward in the dictionary. on sucess direct to main form
here is my code. pls help`
string connectionstring =
"Data Source =localhost;Initial Catalog=HSM;" +
"User Id=sysad;Password=mypassword";
SqlConnection connection = new SqlConnection(connectionstring);
SqlCommand selectcmd = new SqlCommand("Select * from users");
SqlDataReader reader ;
Dictionary<string,string> logintest = new Dictionary<string,string>
try
{
connection.Open();
reader = selectcmd.ExecuteReader();
while (reader.Read())
{
Mainform main1 = new Mainform();
this.Hide();
main1.Show();
}
reader.Close();
`
Simple