Login Page to verify NIC number
<p>I am facing the followingj problem: I have a database on Access 2010 with fields <code>NIC</code>,<code>Active</code> and <code>Page</code>, all are of number types. I want to create a login page that takes <code>NIC</code> (numeric) as an input from the user and then redirects them to specific page as per their NICs.</p>

<p>Different people will see different pages.. I am getting an error in <code>ExecuteScalar</code> command, maybe my query is not correct or maybe <code>ExecuteScalar</code> can't hold the query... I am getting <code>data type mismatch</code> error.</p>

<pre><code>try
{
    FirsstPage f = new FirsstPage();
    SecondPage second = new SecondPage();
    oledcon.Open();

    string NIc = ( TextBox1.Text);
    // string query = "select * from LogINTable where NIC='" + NIc + "'AND Active=0 AND page=1";
    //string query = "select * from LogINTable where NIC='" + nic + "'AND Active=0";
    string query = "SELECT * FROM LogINTable WHERE NIC= '" + NIc + "' AND Active=0 AND page=1";
    //string query = "select
    OleDbCommand comm = new OleDbCommand( query,oledcon);
    string a = (string) comm.ExecuteScalar();
    if (a != null)
    {
        Response.Redirect("FirsstPage.aspx");
        string update = "update into LogINTable Active='1' where NIC='" + NIc + "' ";
        //OleDbCommand com = new OleDbCommand();
        //int b = Convert.ToInt32( com.ExecuteScalar());
    }
    else
    {
        Response.Redirect("SecondPage.aspx");
        string update = "update into LogINTable Active='1' where NIC='" +NIc + "' ";
    }

    oledcon.Close();
}
catch (Exception ex)
{
    Label1.Text = ex.Message;
}
finally 
{
    oledcon.Close();
}
</code></pre>
