Hi all,
My need is to insert sql result into variable in vba Excel.
Here is my code:
Code
Sub ghghghghg()
Dim objADO
Dim objRs
Dim strSQL
Dim j As Integer
Set objADO = CreateObject("ADODB.Connection")
objADO.Properties("Prompt") = 2 'Prompt Always
objADO.Open "Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=servername; UID=; PWD=;"
strSQL = "SELECT count(*) INTO '" & j & "' from tablename "
objADO.BeginTrans
objADO.Execute strSQL
objADO.CommitTrans
objADO.Close
Set objADO = Nothing
End Sub
Display More
The execution interrupts at line "objADO.Execute strSQL" with error message:
Run-time error '-2147217900 (80040e14)':
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00905: missing keyword
What I'm missing?
Another question is how do I tune "Prompt" property in order to ask username and password only once (do not repeat prompt untill user closes Excel).
Thanks ahead.