I cannot get my search button to take me to the gridview I created on another web form. Below is the Code I am using, I have tried the try/catch code and that gave me errors.
Here the code I have, the only issues with it is when I type in the last name, and hit search, the page does nothing. It will not go to the next page and display on gridview.
OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=PayrollSystem_DB.mdb");
con.Open();
string strqrySearch = "SELECT * FROM tblPersonnel where LastName = @LastName";
OleDbCommand com = new OleDbCommand(strqrySearch, con);
com.Parameters.AddWithValue("strqrySearch", txtSearchName.Text.Trim());
OleDbDataReader dr = com.ExecuteReader();
string strFname = "";
string strPayrate = "";
string strStartdate = "";
string strEnddate = "";
while (dr.Read())
{
strFname = dr["FirstName"].ToString();
strPayrate = dr["PayRate"].ToString();
strStartdate = dr["StartDate"].ToString();
strEnddate = dr["EndDate"].ToString();
Response.Redirect("frmViewPersonnel.aspx");
}
dr.Close();
con.Close();