无效的列名''select语句

时间:2015-11-21 12:44:23

标签: c# sql

我有一个sql语句如下:

public DataTable loadData(string str)
{
        string sql = @"SELECT TOP 1 a.*, b.idCoQuanQuanLy, c.NgayHuong, d.Bac, d.HeSo, e.Ngach, e.idNgach
                       FROM tbCanBo AS a INNER JOIN tbCoQuanSuDung AS b ON a.idCoQuanSuDung = b.idCoQuanSuDung 
                                         INNER JOIN tbQuaTrinhLuong AS c ON a.idCanBo = c.idCanBo 
                                         INNER JOIN tbHeSoLuong AS d ON c.ID = d.ID 
                                         INNER JOIN tbNgach AS e ON d.idNgach = e.idNgach 
                       WHERE a.idCanBo = '"+str+"'ORDER BY c.NgayHuong DESC";
        return conn.GetDataTable(sql);
}

如果数据库的值是序列号,我可以查询成功,如果我收到消息

  

“无效的列名'值'。”

0 个答案:

没有答案