Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Oracle Data Control Object in VB
I used Personal Oracle 8. I try to run the examples
in directory \OraWin95\oo4o21\vb\samples\ . They are about how to use Oracle
Data Control Object in Visual Basic. But when I run these examples, I always
get an error message box which displays "Unable to make connection, ORA-12154:
TNS:could not resolve service name".
I encoutered the same problem when I copy the following code which is in Oracle Objects for OLE 2.1 help file. I failed to run it, again an Error Message box displayed "Unable to make connection, ORA-12154:TNS: could not resolve service name" when the statement "Set OraDatabase = OraSession.DbOpenDatabase("ExampleDb", "scott/tiger", 0&) was executed.
Sub Form_Load ()
'Declare variables as OLE Objects.
Dim OraSession As Object
Dim OraDatabase As Object
Dim OraDynaset As Object
'Create the OraSession Object.
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
'Create the OraDatabase Object by opening a connection to Oracle.
Set OraDatabase = OraSession.DbOpenDatabase("ExampleDb", "scott/tiger", 0&)
'Display the username and database to which you have connected.
MsgBox "Connected to " & OraDatabase.Connect & "@" & OraDatabase.DatabaseName
End Sub
Would any one do me a favor? Thank you so much.
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Nov 24 1998 - 17:38:18 CST
![]() |
![]() |