int cout1;
string cout = "select COUNT(*)where (Select Datename(year,GetDate())+Datename(month,GetDate())) in(select convert(nvarchar(6),FaFangRiQi,112) from DingGongZi where T_id =(select teacherid from TeacherT where TeacherName='"
+ aa + "'))";
DataSet ds = db.GetDataSet(cout);
cout1 = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
本文介绍了一个使用SQL进行复杂条件查询的案例,展示了如何通过拼接SQL语句来统计特定教师在当前年月的记录数量。具体包括字符串拼接、日期函数使用及数据转换等关键步骤。
190

被折叠的 条评论
为什么被折叠?



