Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

error

Posted on 2002-06-25
5
Medium Priority
?
970 Views
Last Modified: 2012-08-14
When I connect visual basic to oracle I got an error

      First I use DAO(Data Access Object) then error is:
               RunTime error '40002';
               IM002:[Microsoft][ODBC Driver manager]Data Source name not found and no default driver specified.

      Next I Use ADO then error is:
               Object Variable or With block variable not set.
EX:
   Dim conn As ADODB.Connection
   Dim rs As Recordset
   conn.Open "...", "...", "..."
            ^DSN   ^User  ^Password
   Set rs = conn.Execute("SELECT * FROM  theTable")

In below I don't know which path i give.

conn.open"HERE WHICH PATH I GIVE"," ", " "

   I GIVE IN THIS WAY:
   conn.Open "C:\Program Files\Common Files\ODBC\Data Sources\vij.dsn", "scott", "tiger"

                                     OR
   conn.Open "vij.dsn", "scott", "tiger"

But error is same.
Please suggest me answer.

0
Comment
Question by:vijay_bp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:rpai
ID: 7107619
How is that you have created your dsn?

Follow these steps on your computer to add a new System DSN or check the name of an existing data source :-
1. Double-click the ODBC Data Source icon in the Control Panel.
2. In the Data Sources dialog box, click System DSN.
3. Click Add if you do not see the name of the System DSN you used.
4. If creating a new one, Select the driver as 'Microsoft ODBC for Oracle' and click Finish. Now add all the parameters.
5. Once you dsn is created right, you should be able to execute the above lines of code.

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7107660
conn.Open "C:\Program Files\Common Files\ODBC\Data Sources\vij.dsn;UID=scott;Pwd=tiger"

Try this instead.

0
 
LVL 3

Accepted Solution

by:
PNJ earned 180 total points
ID: 7107667
You need to check that you have got a service set up in the Oracle bits and pieces. Depending on which version of Oracle depends on what it's called. If you're using Net8 then use "Oracle Net 8 Easy Config" and set up a service that points to the listener on the database. (It's a similar name on V7, but I can't remember exactly what it's called). Call the service "TestServer" for this example.

and then

   Dim gadoConnect as ADODB.Connection
   Dim Connect     as String
...
   Set gadoConnect = New ADODB.Connection
   Connect = "ConnectString=TestServer;UID=uname;PWD=upass;Driver={Microsoft ODBC Driver for Oracle}"

   gadoConnect.ConnectionString = Connect
   gadoConnect.open , , , adConnectUnspecified

This is for a DSNless connection
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7963024
Hi vijay_bp,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept PNJ's comment(s) as an answer.

vijay_bp, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8039081
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question