This is a small portion of my code file. Each time my debugger reaches the line 'NewDA.Fill(NewDS);' at runtime it jumps to the catch. I'm positive the daynumber variable gets a value that's present in the database and I've tried the query outside of the codefile on my database and it works fine. I'm also using the connectionstring 'db' on more parts of the code with successful results.
string QueryNew = "SELECT activityname AS [Name], activitycategorynumber AS [Category] " +
"FROM ACTIVITY WHERE daynumber = @daynumber";
SqlCommand NewCmd = new SqlCommand(QueryNew, db);
NewCmd.Parameters.Add("@daynumber", SqlDbType.Int).Value = daynumber;
SqlDataAdapter NewDA = new SqlDataAdapter(NewCmd);
DataSet NewDS = new DataSet();
NewDA.Fill(NewDS);