我正在尝试使用宏打开一个新连接,但声明“Rcrdst.Open”正在给我运行时错误:“ORA-00911:无效字符”。有人可以帮我找到问题吗?
Dim C As Integer
Dim ambiente As String
Dim userid As String
Dim Password As String
Dim Query As String
Dim Newsht As Worksheet
Dim Conn As ADODB.Connection
Dim Rcrdst As ADODB.Recordset
Set Newsht = ActiveWorkbook.Sheets("sheet1")
ambiente = InputBox("Please insert environement in which query has to be run.", "Test")
userid = InputBox("Please insert your USER ID for " & ambiente & " environment.", "Test")
Password = InputBox("Please insert the PASSWORD related to " & userid & " user.", "Test")
If userid <> "" And Password <> "" Then
Set Conn = New ADODB.Connection
Conn.ConnectionString = "Provider=MSDAORA; Password= " & Password & ";User ID= " & userid & "; Data Source = " & ambiente & ";Persist Security Info=True"
Conn.Open
Query = "select seq_prenotazione, cod_rapporto,stato_pren from via.prenotazione where seq_prenotazione in (700016298527, 700016761977);"
Set Rcrdst = New ADODB.Recordset
Rcrdst.CursorLocation = adUseClient
Rcrdst.CursorType = adOpenStatic
Rcrdst.LockType = adLockBatchOptimistic
Rcrdst.Open Query, conn
'code to work on data extracted
end if
Rcrdst.Close
Conn.Close
提前致谢
答案 0 :(得分:2)
从查询中删除尾随的;
。
有时你需要它,有时候你不需要它。也许Oracle专家可以解释它。