简体   繁体   中英

Why am I getting the error Incorrect syntax near 'BYStock_Date'?

I am getting above error in this query.

string query3 = "select Stock_Price,Stock_Quan_Met from Stock where Item_Id=(select ItemTileId from ItemTiles where ItemName=@itm) ORDER BY"+
            "Stock_Date ASC";

Your query results in

select Stock_Price,Stock_Quan_Met from Stock where Item_Id=(select ItemTileId from ItemTiles where ItemName=@itm) ORDER BYStock_Date ASC

Add a space at least and you fine.

string query3 = "select Stock_Price,Stock_Quan_Met from Stock where Item_Id=(select ItemTileId from ItemTiles where ItemName=@itm) ORDER BY "+
            "Stock_Date ASC";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM