Hello I am new to csharp and am having some trouble with a projec that I am working on. I have a database(access) and am using a window form for a login page. The login is supposed to check a couple conditions and then return an int from the database which says which accesslevel that login has. Something is wrong with my code I am having trouble with making the return value an int and am just lost. Any help would be appreciated my code is below.
private void Submitbutton_Click(object sender, EventArgs e)
{
OleDbConnection objconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c://documents and settings/davidsinclair/My Documents/Visual Studio 2005/Projects/PINS/PINS/pinsdb.mdb");
OleDbCommand cmdLogin = new OleDbCommand("select EmployeeAccessLevel from OSicher where (EmployeeName = 'warehouse' AND EmployeePassword = 'house') OR (EmployeeName = 'inventory' AND EmployeePassword = 'staff')", objconn);
try
{
objconn.Open();
OleDbDataReader radLogin = cmdLogin.ExecuteReader();
while (radLogin.Read())
{
int result = (int)radLogin(EmployeeAccessLevel);
if (result = "1")
{
frmManagerHome frm = new frmManagerHome();
frm.Show();
}
}
radLogin.Close();
objconn.Close();
}
catch(OleDbException er)
{
Console.WriteLine("Error: {0}", er.Errors[0].Message);
}
}