12-07-2011, 05:29 PM
Hi Rajendra,
Try the following code and let me know how it goes:
Replace host name, port, service name, uid and password with your original values.
Try the following code and let me know how it goes:
Code:
Dim strConn
strConn = "Driver= {Microsoft ODBC for Oracle}; " &_
"ConnectString=(DESCRIPTION=" &_
"(ADDRESS=(PROTOCOL=TCP)" &_
"(HOST=host name) (PORT=port no))" &_
"(CONNECT_DATA=(SERVICE_NAME=service name)));uid=user id; pwd=password;"
Dim obConnect
Dim obRecset
Set obConnect =CreateObject("ADODB.Connection")
Set obRecset = CreateObject("ADODB.Recordset")
obConnect.Open strConn
Dim queryStr
queryStr = "select * from TABLE" // your query
Set obRecset = obConnect.Execute(queryStr)
obRecset.MoveFirst
GetDBField = obRecset.Fields(0).Value
Replace host name, port, service name, uid and password with your original values.