ExecuteNonQuery is not return the results of sql statement which executed, you can use
DataReader[
^] or
DataAdapter[
^] to get DataSet or DataTable result. Read the documentation and check the samples in the MSDN for more information.
after you get DataTable or DataSet you can return that object from FindRecord method by changing the signature as below
public DataTable FindRecord(int RollNumber)
{
}
Then you can get the data table as below
Dal objdal = new Dal();
DataTable dt= objdal.FindRecord(RollNumber);
sample code:
public DataTable FindRecord(int RollNumber)
{
using(SqlConnection sqlConn = new SqlConnection(cs))
using(SqlCommand cmd = new SqlCommand("spfindtblstudent", sqlConn))
{
cmd.Parameters.Add("@RollNumber", RollNumber);
cmd.CommandType = CommandType.StoredProcedure;
sqlConn.Open();
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
return dt;
}
}
I assume that your stored procedure having select statement which return matching data.