I have the below code that runs on data in the Oracle SDE.
I would like to run the same simple simple query on data in a file geodatabase, but I just get and error -2147467259 (80004005).
If I change the sql to take out the word "Count" then everything is fine.
I need to get Count, Maximum and Minimum from a Standalone table in a File Geodatabase.
Please help.
Thanks
Private Sub cmdCheck_Click()
'error handler
On Error GoTo EH
Dim oConn As ADODB.Connection
Dim strConnect As String
Dim rs As ADODB.RecordSet
Dim strSql As String
' open the database
Set oConn = New ADODB.Connection
strConnect = "Provider=OraOLEDB.Oracle;" & frmMain.g_ADODataSource & _
"User Id='" & frmMain.g_strDB & "';" & "Password='" & frmMain.g_strPW & "'"
oConn.Open strConnect
' create and run the query
strSql = "select count(*) from mytablename "
Set rs = New ADODB.RecordSet
rs.Open strSql, oConn
MsgBox rs(0).Value & " records"
oConn.Close
Exit Sub
EH:
MsgBox "Error in Check " & vbCrLf & _
Err.Description & vbCrLf & Err.Number
End Sub