[VBA ] Oracle回傳查詢筆數

看板Visual_Basic作者 (tt)時間5年前 (2019/01/25 08:35), 5年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
大家好 我用VBA連線Oracle查詢要回傳筆數 .RecordCount 總是回傳-1 .Fields.Count 可以正常回傳欄位數量 可以幫忙看一下是哪邊錯了嗎 再拜託大家了 謝謝! Sub test() Dim strConOracle As String strConOracle = "Provider=MSDASQL.1;Persist Security Info=False;User ID=" & sql_username & ";Password=" & sql_password & ";Data Source=abcdtest" Set oConOracle = CreateObject("ADODB.Connection") Set oRsOracle = CreateObject("ADODB.RecordSet") Set OracleCommand = CreateObject("ADODB.Command") oConOracle.Open strConOracle With OracleCommand .ActiveConnection = oConOracle .CommandType = 1 .CommandText = "SELECT * FROM DBACD.TEST001" .CommandTimeout = 300 End With Set oRsOracle = OracleCommand.Execute MsgBox "column count: " & oRsOracle.Fields.Count & vbLf & "row_count: " & oRsOracle.RecordCount Set oConOracle = Nothing: Set oRsOracle = Nothing: Set OracleCommand = Not hing End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.141.85.71 ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1548376524.A.9E1.html ※ 編輯: tt9981 (223.141.85.71), 01/25/2019 08:39:15
文章代碼(AID): #1SIbdCdX (Visual_Basic)
文章代碼(AID): #1SIbdCdX (Visual_Basic)