Storing Number in an integer from sql Database
<p>i am using database with table RESUME and column PageIndex in it which type is number in database but when i want to store this PageIndex value to an integer i get exception error</p>

<p><strong>Specified cast is not valid.</strong></p>

<p>here is the code</p>

<pre><code>string sql;
string conString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=D:\\Deliverable4.accdb";
protected OleDbConnection rMSConnection;
protected OleDbDataAdapter rMSDataAdapter;
protected DataSet dataSet;
protected DataTable dataTable;
protected DataRow dataRow;
</code></pre>

<p>on Button Click</p>

<pre><code>sql = "select PageIndex from RESUME";
rMSConnection = new OleDbConnection(conString);
rMSDataAdapter = new OleDbDataAdapter(sql, rMSConnection);
dataSet = new DataSet("pInDex");
rMSDataAdapter.Fill(dataSet, "RESUME");

dataTable = dataSet.Tables["RESUME"];
</code></pre>

<blockquote>
  <p>int pIndex =
  (int)dataTable.Rows[0][0];</p>
</blockquote>

<pre><code>rMSConnection.Close();

if (pIndex == 0)
{            
    Response.Redirect("Create Resume-1.aspx");
}
else if (pIndex == 1)
{            
    Response.Redirect("Create Resume-2.aspx");
}
else if (pIndex == 2)
{          
        Response.Redirect("Create Resume-3.aspx");
    }
}
</code></pre>

<p>i am getting error in this line  </p>

<pre><code>int pIndex = (int)dataTable.Rows[0][0];
</code></pre>
