Hi, I am doing login using data reader of C#. Here is my codes,
try
{
Access_Db.OpenTransaction();
Access_Db.BeginTransaction();
bool usrExist = false;
string SQLStr = "SELECT ID,Password FROM RegisterEmployee";
OleDbCommand sqlComm = new OleDbCommand(SQLStr);
OleDbDataReader reader = sqlComm.ExecuteReader(); // program got exception when run till here
while(reader.Read())
{
if (reader["ID"].ToString() == usrfield.Text.ToString() && reader["Password"].ToString() == passdField.Text.ToString())
{
usrExist=true;
}
else
{
usrExist=false;
}
}
reader.Close();
When I executed the program, an exception "Connecton property not initialized for ExecuteReader" had occured. What had happened?