列名称无效 "account"

Invalid column name "account"

我的代码执行得很好,但在我的 java 输出上执行后,它显示了无效列名帐户的错误。

这是我的查询字符串,

{
  String sql = 
  "SELECT [account]" +"[date] 
   FROM [reports].[dbo].[acc] 
   WHERE [account='"+str+"'";
}

异常:

Exceptioncom.microsoft.sqlserver.jdbc.SQLServerException: The column name account is not valid

试试这个:

{
  String sql = 
  "SELECT [account]," +"[date] 
   FROM [reports].[dbo].[acc] 
   WHERE [account]='"+str+"'";
}