i checked column name it is correct and put &&.
another thing i did is
Code:
OleDbConnection databaseConnection = new OleDbConnection(ConnectionString);
try
{
databaseConnection.Open();
string selectCommand = "Select p_name and p_pass from personel";
OleDbCommand databaseCommand = new OleDbCommand(selectCommand, databaseConnection);
OleDbDataReader reader = databaseCommand.ExecuteReader();
while (reader.Read())
{
string user = reader.GetString(reader.GetOrdinal("p_name"));
string password = reader.GetString(reader.GetOrdinal("p_pass"));
// string name = reader["p_name"].ToString();
//string password = reader["p_pass"].ToString();
if ((user == pad_text.Text) && (password == psifre_text.Text))
{
MessageBox.Show("it is ok");
}
else
{
MessageBox.Show("it is not ok");
}
}
}
catch (OleDbException databaseException)
{
}
catch (IndexOutOfRangeException exception)
{
MessageBox.Show("Index out of range !");
}
finally
{
databaseConnection.Close();
}
}
i wrote an exception which is about Indexoutofrange
when i run the program and enter the username and password program warns me
"Index out of range !". what can i do now?