我正在尝试连接和查询 Oracle 数据库并将结果加载到数据表中,但我不断收到以下代码的“由于对象的当前状态导致操作无效”错误:
Using conn As New OracleConnection(oradb)
Try
cmd = New OracleCommand()
da = New OracleDataAdapter(cmd)
dteDTK = New DataTable()
conn.Open()
cmd.CommandText = "SELECT * FROM TABLE1"
cmd.CommandType = CommandType.Text
da.Fill(dteDTK)
Catch ex As OracleException
MessageBox.Show(ex.Message.ToString())
Finally
conn.Close()
conn.Dispose()
End Try
End Using
'da.Fill(dteDTK)' 命令引发错误。我在这里想念什么?