0

I have a sql statement is as follows:

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);
}

I can query succeed if the value of the database is the sequence number if I will get the message

"Invalid Column Name 'value'."

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
  • Which value in which column exactly is the one that this statement is working with? – w33z33 Nov 21 '15 at 12:59
  • where is `VALUE` column in your select query. I think in your `tbCanBo` have value column? – Ajay2707 Nov 21 '15 at 13:13
  • Your query does not involve a column named `Value`. This would strongly suggest you are mentioning this column in `str` as rene said, and that you should really [meet Booby Tables](http://stackoverflow.com/q/332365/11683). – GSerg Nov 21 '15 at 13:14

0 Answers0