所以我试图在我的数据库中找到在特定列具有相同值的两个 ID,即
SELECT SALARY FROM TABLE1 WHERE ID='1'
INTERSECT
SELECT SALARY FROM TABLE2 WHERE ID='5'
所以我在VS2010中做了
Dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\\;Extended Properties=dBase IV"
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
dBaseConnection.Open()
Dim myQ As String = "SELECT 'SALARY' FROM TABLE1 WHERE ID='1' INTERSECT SELECT 'SALARY' FROM TABLE2 WHERE ID='5'"
Dim dBaseCommand As New System.Data.OleDb.OleDbCommand(myQ, dBaseConnection)
Dim dBaseDataReader As System.Data.OleDb.OleDbDataReader = dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess)
执行最后一行时出现此错误
System.Data.dll 中出现“System.Data.OleDb.OleDbException”类型的未处理异常
附加信息:IErrorInfo.GetDescription 失败,出现 E_FAIL(0x80004005)。
难以置信,当我使用 UNION 而不是 INTERSECT 作品时
任何想法,谢谢