如何用Query实现?
诸位前辈,我在编写一与数据有关的模块时遇到一个问题:
qryKeCheng->SQL->Add("select count (distinct sno) from t_kecheng where courseno='"+daihao->text+'"");
当我直接用all->text=qryKeCheng->FieldByName("count (distinct sno)")->AsString;编译时提示不能找到count (distinct sno)这个字段名,如果用存储过程来写的话可以实现,但由于服务器数据库善未建好,如何用Query实现?
t_kecheng一table名,sno是学生学号,sql语句是想统计选修某一课程的学生的总人数。
all和daihao是两个编辑框控件类。