select a.CardID,a.EmployeeID,a.EmployeeName,b.DateTimeBrush,a.SexID,c.DepartmentName from TC_Employee a left join AT_CardBrushRecord b on a.CardID=b.CardId left join TC_Department c on a.DepartmentID=c.DepartmentID where c.Departmentname='asd' and b.DateTimeBrush between 2010-04-07 14:02:50.020 and 2016-04-07 14:02:50.020 group by a.CardID,a.EmployeeID,a.EmployeeName,b.DateTimeBrush,c.DepartmentName select COUNT(a.CardID) from TC_Employee a left join TC_Department b on a.DepartmentID=b.DepartmentID where a.DepartmentID=1 public DataTable GetEmp() { string sql = "select a.CardID,a.EmployeeID,a.EmployeeName,b.DateTimeBrush,c.DepartmentName, from TC_Employee a " + "left join AT_CardBrushRecord b on a.CardID=b.CardId " + " left join TC_Department c on a.DepartmentID=c.DepartmentID " ; return YC.Common.SqlDataAccess.GetDataTable(sql); }
就是上面的两个数据库里里面的查询语句,要怎么弄到程序里,作为一个sql语句啊
你想显示的数据是一个对象还是一个集合
是显示在水晶报表里面的数据,是一个对象
@菜鸟、编程: string sql = "select a.CardID,a.EmployeeID,a.EmployeeName,b.DateTimeBrush,c.DepartmentName,
(string sql = "select a.CardID,a.EmployeeID,a.EmployeeName,b.DateTimeBrush,c.DepartmentName, from TC_Employee a " + "left join AT_CardBrushRecord b on a.CardID=b.CardId " + " left join TC_Department c on a.DepartmentID=c.DepartmentID " ) as count
from TC_Employee a " + "left join AT_CardBrushRecord b on a.CardID=b.CardId " + " left join TC_Department c on a.DepartmentID=c.DepartmentID " ; 这样应该是可以的
@渴死的鱼丶: 报错额
@菜鸟、编程: 先放数据库调试一下 看看什么问题先
找网站渗透检测高手,月保5万以上。
找网站渗透检测高手,月保5万以上。
@渴死的鱼丶: 放数据库说是有语法错误
找网站渗透检测高手,月保5万以上。
直接放进去,在第一句后面加个英文分号,用dataset接收