我已經創建了一個簡單的Oracle表,我試圖連接到VB.net在Oracle中插入查詢:無效的表名
我能夠連接但我無法向表中添加任何記錄。我收到消息:ORA-00903:表名無效。
以下是我從中創建表的Oracle數據庫管理器的預覽屏幕。
Oracle Enterprise Manager screenshot (Sorry it's in french)
這裏是我使用的代碼:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Oracle = New OracleObject("192.128.7.15", 1521, "TechnicalDatabase", "system", "admin")
If Oracle.Connect = False Then
Exit Sub
End If
Dim Sql As String
Sql = "INSERT INTO USER (ID, FirstName) values ('1','Jim');"
Oracle.ExecuteSubQuery(Sql)
Oracle.Disconnect()
End Sub
Public Function ExecuteSubQuery(ByVal SQL As String) As Boolean
Dim Command As New OracleCommand(SQL, Connection)
Command.CommandType = CommandType.Text
Try
Command.ExecuteReader()
Catch ex As Exception
MsgBox("Error in query !" & Chr(13) & ex.Message)
Return False
End Try
Return True
End Function
感謝。
如果您沒有連接成表的所有者,除非a)該表完全符合模式名稱,或者b)您有指向該表的同義詞,或者c)您更改了該表會話設置current_schema。 –