I have this query:
SELECT COUNT(*) From Employees
I execute the query and have this:
public static int GetNumJobs()
{
clsJobPosting JobPosting = new clsJobPosting();
DataSet dsJobs = JobPosting.GetNumRows();
DataTable dtJobs = dsJobs.Tables[0];
return Convert.ToInt32(dtJobs.Rows[0]);
}
GetNumRows() returns the dataset, I want to return the number of rows from this query, how can I accomplish this?
try changing this
to this
Also, why are you returning a
DataSetfromJobPosting.GetNumRows()? You should return anintthere so you don’t have to repeat the same logic all over your code.