public static DataSet GetQuesCountDetail(int subjectid, String tableName) { String strSql = "SELECT [tbChapter].[id],[chapterno],[chaptername],COUNT([chaptername]) AS AllCount FROM [tbChapter] ," + tableName + " WHERE [tbChapter].[id]=" + tableName + ".[chapterid] AND subjectid=@subjectid GROUP BY [tbChapter].[id],[chaptername],[chapterno] ORDER BY [chapterno]"; MyUtil.PrintSql(strSql); return(DbHelperSQL.Query(strSql, new SqlParameter("@subjectid", subjectid))); }
public static int GetQuesCount(int subjectid, String tableName) { String strSql = "select count(*) from " + tableName + " where chapterid in (select id from tbChapter where subjectid=" + subjectid + ");"; MyUtil.PrintSql(strSql); return((int)DbHelperSQL.GetSingle(strSql)); }