vb.net IErrorInfo.GetDescription 因 E_FAIL(0x80004005) 失败。[保留字访问]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20838483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 16:17:49  来源:igfitidea点击:

IErrorInfo.GetDescription Failed With E_FAIL(0x80004005). [Reserved Word For Access]

vb.netconnectionoledbusing

提问by

Private Sub ComboBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Click
    cmd2 = New OleDb.OleDbCommand("Select [Member_Id] From Member_Details  EXCEPT select [M_Ids] from Books_Issue", cn)
    '  cmd2 = New OleDb.OleDbCommand(" Select Member_Id From Member_Details LEFT JOIN Books_Issue ON Member_Id =M_Ids Where ((M_Ids) Is Null)", cn)
    da = New OleDbDataAdapter(cmd2)
    ds = New DataSet
    da.Fill(ds, "Members")
    With Me.ComboBox1
        ComboBox1.DataSource = ds.Tables(0)
        ComboBox1.DisplayMember = "Member_Id"
    End With
End Sub

采纳答案by User999999

You're Query is just wrong. 'Except' doesn't exist in MS ACCESS. You can easily avoid the usage of Except with the following structure:

你的查询是错误的。MS ACCESS 中不存在“除外”。您可以通过以下结构轻松避免使用Except:

 Select * 
 from tableA
 where NOT EXISTS
  ...

Or

或者

 Select * 
 from tableA
 where NOT IN
  ...

In your Case (if M_Ids is the same type as Member_ID):

在您的案例中(如果 M_Ids 与 Member_ID 的类型相同):

 Select [Member_Id] From Member_Details md 
 WHERE NOT EXISTS 
 (select [M_Ids] from Books_Issue WHERE [M_Ids] = md.[Member_ID])