首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

提示:语法异常 (操作符丢失) 在查询表达式 'FileStyle=审核order by FinanceID desc' 中

2012-05-08 
提示:语法错误 (操作符丢失) 在查询表达式 FileStyle审核order by FinanceID desc 中。public DataTable

提示:语法错误 (操作符丢失) 在查询表达式 'FileStyle=审核order by FinanceID desc' 中。
public DataTable SelectStyleFinance(string FinanceStyle) 
  { 
  strOleDb = new StringBuilder(); 
  strOleDb.Append("select FinanceData as 收到日期,ArchivesNum as 归入案卷号,FileNum as 来文号,Department as 来文机关或部门,FileTitle as 拟办 FROM FINANCE"); 
  strOleDb.Append(" where FileStyle=" + FinanceStyle + ""); 
  strOleDb.Append("order by FinanceID desc"); 

  return DB.Fill(strOleDb.ToString()); 
  } 

提示:语法错误 (操作符丢失) 在查询表达式 'FileStyle=审核order by FinanceID desc' 中。 
什么错误 


[解决办法]
'FileStyle=审核order by FinanceID desc'

前面就个空格

C# code
strOleDb.Append(" order by FinanceID desc ");
[解决办法]
strOleDb.Append(" where FileStyle=" + FinanceStyle + ""); 
strOleDb.Append(" order by FinanceID desc");

少了空格
[解决办法]
SQL code
'FileStyle='审核' order by FinanceID desc'
[解决办法]
关注
[解决办法]

热点排行