日期:2014-05-16  浏览次数:20902 次

一条select在access里不能执行,c#下开发
string   qryDiary= "select   userName,writeDate,year(writeDate)   as   writeYear,month(writeDate)   as   month,   day(writeDate)   as   day,   diary,weather,mode,theme   from   diary   where   userName= ' "+GlobleVar.currentUser.Trim()+ " ' ";

提示为:
select子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确

我没有看出来有什么错误啊,这个在sqlserver里是能正常运行的,后来转到access就出错了

------解决方案--------------------
string qryDiary= "select [userName],writeDate,year(writeDate) as writeYear,month(writeDate) as [month], day(writeDate) as [day], diary,weather,mode,theme from diary where [userName]= ' "+GlobleVar.currentUser.Trim()+ " ' ";