Link to home
Start Free TrialLog in
Avatar of vijay_bp
vijay_bp

asked on

error

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.

Avatar of rpai
rpai

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.

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

Try this instead.

ASKER CERTIFIED SOLUTION
Avatar of PNJ
PNJ

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DanRollins
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
Per recommendation, force-accepted.

Netminder
EE Admin