我知道这是非常基本的,我已经这样做了数百次。但是,出于某种奇怪的原因,我在数据库上执行了这个命令,当它试图从结果中读取一列时它失败了。如果我在以相同凭据登录的 SQL Plus 中执行此语句,则选择行(表有 1 行)就好了。任何想法我做错了什么?我尝试按名称、索引以及任何列访问列——它们都没有提供任何数据。我试过没有 .NextResult() (以防万一),同样的例外。
'...
' Determine if this database is Multisite enabled
Dim multisiteCmd As OleDbCommand = DbConnection.CreateCommand
multisiteCmd.CommandText = "SELECT * FROM TDM_DB_VERSION;"
Dim dbVersionReader As OleDbDataReader = multisiteCmd.ExecuteReader()
If dbVersionReader.HasRows Then
dbVersionReader.NextResult()
'If a ReplicaID was generated for the Database ID, then this is part of a
'multisite implementation
'Dim dbRepID As String = dbVersionReader("DB_REPLICID")
Dim dbRepID As String = dbVersionReader(9)
PluginSettings.UseMultisite = False
If Not dbRepID Is Nothing Then
If dbRepID.Length > 0 Then
PluginSettings.UseMultisite = True
PluginSettings.MultisiteReplicaId = dbRepID
End If
End If
End If
dbVersionReader.Close()
从这些立即命令可以看出,连接是打开的:
? DbConnection.Provider“OraOLEDB.Oracle”?DbConnection.State 打开 {1}