OleDbDataAdapter错误“IErrorInfo.GetDescription失败并带有E_FAIL(0x80004005)” VB.NET [英] OleDbDataAdapter error "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)" VB.NET

查看:110
本文介绍了OleDbDataAdapter错误“IErrorInfo.GetDescription失败并带有E_FAIL(0x80004005)” VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用标准的ms access 2000和2002-2003 mdb文件。

当我使用VB.NET调试系统并运行DataAdapter时,我收到以下消息

错误框标题为OleDBException未处理

并在错误框下面是

IErrorInfo.GetDescription失败并带有E_FAIL(0x80004005)



我的系统链接到ms访问。



以下是我的系统代码部分(错误代码):

i'm using a standard ms access 2000 and 2002-2003 mdb file.
When I debug a system using by VB.NET and run the DataAdapter, i get the following message
The error box title is "OleDBException was unhandled"
and under the error box is
"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)"

My system is link to ms access.

The following is my part of the system code(error code):

Dim sql As String = "Select Options From USERDT Where USERID='" + Label2.Text + "' AND Module='TAS' AND FormName='Staff'"
        Dim cmd As New OleDbCommand(sql, connect)
        dSet.Reset()
        dAdapter.SelectCommand = cmd
        dAdapter.Fill(dSet) '''this part getting error(IErrorInfo.GetDescription failed with E_FAIL(0x80004005))
        If dSet.Tables(0).Rows(0).Item("Options") = "N" Then
            MsgBox("Access Deny!")
        ElseIf dSet.Tables(0).Rows(0).Item("Options") = "R" Or dSet.Tables(0).Rows(0).Item("Options") = "W" Then
            Form12.Show()
        End If





有什么问题?没有保留字,我已经更改了所有保留字。

请帮忙。



提前致谢。



What is the problem? There is no reserved words, I has change all the reserved words.
Please help.

Thanks in advance.

推荐答案

请阅读virusstorm对问题的评论和帖子: IErrorInfo.GetDescription失败并带有E_FAIL(0x80004005) - 这个错误是什么意思? [ ^ ]。不要使用保留字 [ ^ ]或在字段名称周围加上方括号 [] 或表名,即:

Please, read virusstorm's comment to the question and and this post: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)- What does this error means?[^]. Do not use reserved words[^] or put the square brackets [] around the field name or table name, ie:
Dim sql As String = "SELECT [Options] FROM [USERDT] WHERE [USERID]='" & Label2.Text & "' AND Module='TAS' AND FormName='Staff'"





注意:使用& 连接VB.NET中的字符串。 + 通常用于添加数字。请参阅: Visual Basic中的串联运算符 [ ^ ]



Note: use & to concatenate a string in VB.NET. + is usually used to add numbers. See this: Concatenation Operators in Visual Basic[^]


USERID是数字?如果是这样,



USERID is numeric? If so,

Dim sql As String = "SELECT [Options] FROM [USERDT] WHERE [USERID]='" & Trim(Str(Label2.Text)) & "' AND Module='TAS' AND FormName='Staff'"





这有用吗?



Does that work?


Sql = "SELECT * FROM Sheet3 WHERE Category LIKE 'OBC%'"



请确保您的写字段名称正确。没有空格,没有符号只有下划线


Be Sure That Your Write Field Name Correct. No Space And No Symbol Only Underscore


这篇关于OleDbDataAdapter错误“IErrorInfo.GetDescription失败并带有E_FAIL(0x80004005)” VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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