Oracle Data Control Object in VB

From: <xiaodipi_at_my-dejanews.com>
Date: Tue, 24 Nov 1998 23:39:30 GMT
Message-ID: <73fg3e$f7u$1_at_nnrp1.dejanews.com>



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 [Quoted] 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 from 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 & "_at_" & 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 Wed Nov 25 1998 - 00:39:30 CET

Original text of this message