首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

sql转access的有关问题

2012-01-24 
sql转access的问题已经开了很多帖子了,试验过无数遍,发现在sql里面没问题可是换成access数据库问题就多多

sql转access的问题
已经开了很多帖子了,试验过无数遍,发现在sql里面没问题可是换成access数据库问题就多多了
string   myselect   =   "   select   account.*,hte-glf   +(case   when   (select   Sum(sr-zc)   from   [type]   where   [type].bianhao=account.bianhao)   is   null   then   0   else   (select   Sum(sr-zc)   from   [type]   where   [type].id=account.bianhao)   end)   as   余额from   [account] ";
不知道有没有解决的办法了,已经用了[]可是还是提示IErrorInfo.GetDescription   因   E_FAIL(0x80004005)   而失败。


[解决办法]
lz的查询语句看着就觉得很有问题,把你的access数据库和要的结果发到我邮箱wzq6511@163.com我看看
[解决办法]
select account.* , hte-glf+ iif( (select sum(sr-zc) from [type] where [type].bianhao=account.bianhao) is null ,0,(select sum(sr-zc) from [type] where [type].bianhao=account.bianhao)) as ye from account

這個可以


isnull用的有問題,MS SQL和ACCESS還是有不少區別。

PS:樓主的筆誤太多,一會是“accout”,一會是“account”。

前面的關聯條件是“[type].bianhao=account.bianhao”,後面又是“[type].id=account.bianhao”。

热点排行