难以解决IErrorInfo.GetDescription失败 [英] Difficulty solving IErrorInfo.GetDescription failed

查看:81
本文介绍了难以解决IErrorInfo.GetDescription失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于查询数据库的SQL查询,但是一旦OleDbDataAdapter执行它的fill命令,就会抛出此消息.确切的错误消息:

"IErrorInfo.GetDescription失败,出现E_FAIL(0x80004005)."

我已经在Access中成功测试了我的SQL查询,因为Access可以处理该查询,我完全为问题所困扰.我的工作(但不如我想的那样优雅)是SQL查询,其中PageSize和intSkip是整数,分别指示页面上的记录数以及先前页面上的记录总数:

I have a SQL query used to page through a database but throws this message once the OleDbDataAdapter executes it''s fill command. The exact error message:

"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)."

I have tested my SQL query in Access with success, seeing as Access can handle this query I''m completely stumped as to what is the problem. My working, yet not as elegant as I may want, SQL query where PageSize and intSkip are integers indicating the number of records on a page as well as the sum total of records on previous pages respectably:

SELECT TOP " + this.PageSize + " * FROM(SELECT SiteName, DateTimeMeas FROM (SELECT TOP " + this.PageSize + " * FROM (SELECT TOP " + intSkip + " * FROM ( SELECT DISTINCT SiteName, DateTimeMeas FROM TimeDep )) AS internal ORDER BY SiteName DESC) AS external ORDER BY SiteName ASC)



任何帮助将不胜感激.



Any help will be appreciated.

推荐答案

有几个问题.

1.您需要为最里面的派生表加上别名.
2. external是SQL中的保留字,因此请在其周围加上[].
3.在SiteName,DateTimeMeas
前的第二个SELECT中需要一个TOP 4.您需要为最外面的表加上别名.

试试这个

There are several problems.

1. You need to alias your innermost derived table.
2. external is a reserved word in SQL so put [] around it.
3. You need a TOP in your 2nd SELECT before SiteName, DateTimeMeas
4. You need to alias the outermost table.

Try this

SELECT TOP 10 * 
FROM(
	SELECT TOP 10 SiteName, DateTimeMeas 
	FROM (
		SELECT TOP 10 * 
		FROM (
			SELECT TOP 10 * 
			FROM ( 
				SELECT DISTINCT SiteName, DateTimeMeas 
				FROM TimeDep 
			) y
		) AS internal 
		ORDER BY SiteName DESC
	) AS [external]
ORDER BY SiteName ASC) x 


这篇关于难以解决IErrorInfo.GetDescription失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆