public ICollection GetSearchResult(String txtSearch, int StartIndex, int PageSize)
{
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlDataAdapter myCommand = new SqlDataAdapter("GetSearchResult", myConnection);
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterTxtSearch = new SqlParameter("@txtSearch", SqlDbType.VarChar, 255);
parameterTxtSearch.Value = txtSearch;
myCommand.SelectCommand.Parameters.Add(parameterTxtSearch);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, StartIndex, PageSize, "SearchResult");
return myDataSet.Tables["SearchResult"].DefaultView;
}
public int GetSearchResultCount(String txtSearch)
{
int intCount ;
intCount = 0;
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("GetSearchResultCount", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterTxtSearch = new SqlParameter("@txtSearch", SqlDbType.VarChar, 255);
parameterTxtSearch.Value = txtSearch;
myCommand.Parameters.Add(parameterTxtSearch);
myConnection.Open();
SqlDataReader dr =myCommand.ExecuteReader();
if(dr.Read())
{
intCount = Int32.Parse(dr["co"].ToString());
}
&nbs