I am filling a dataset from a database. When there are no rows to return it still tells me that the count is 1. I can't figure out what is going wrong. if I look at a visual of the dataset, the row is blank, but the count is 1.
public static DataSet FillCat2(string current, string previous, string choice)
{
DataSet dt = new DataSet();
string conString = ConfigurationManager.ConnectionStrings[""].ToString();
try
{
using (SqlConnection conn = new SqlConnection(conString))
{
SqlCommand comm = new SqlCommand("select distinct " + current + " from ourcategories where " + previous + "='" + choice + "' order by " + current, conn);
SqlDataAdapter sda = new SqlDataAdapter(comm);
sda.Fill(dt);
return dt;
}
}
catch (Exception e)
{
ExceptionLogger.LogException(e);
throw e;
}
}
Thanks in advance for all the help.