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

x
?
Solved

VB Run-time error 91

Posted on 2004-10-19
8
Medium Priority
?
472 Views
Last Modified: 2013-12-26
I am trying to open a connection to oracle database using following connection string:
cnstr = "Provider=ORAOLEDB.Oracle;Data Source=primedb;User ID=" & txtUserName.Text & ";Password=" & txtPassword.Text & ";"
at the following line:
cn.open cnstr
it gives "Run-time Error 91"
the connection variable is set in general section as "Dim cn as new adodb.connection"
but if i provide the user name and password as hard coded it works fine e.g.
cnstr = "Provider=ORAOLEDB.Oracle;Data Source=primedb;User ID=raajaindra;Password=mypassword;"
what could be the reason and the solution.
0
Comment
Question by:raajbaid
[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
8 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 12354879
are you sure txtUserName.text and txtPassword.text contains the correct values?
0
 
LVL 13

Expert Comment

by:imarshad
ID: 12355692
>>are you sure txtUserName.text and txtPassword.text contains the correct values?
further adding to it...if it contains the correct value then try the following......

dim IntermediateString as string

IntermediateString= "Provider=ORAOLEDB.Oracle;Data Source=primedb;User ID=raajaindra;Password=mypassword;"
cnstr =IntermediateString

Imran
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 12355850
If you perform this, what is displayed ?

cnstr = "Provider=ORAOLEDB.Oracle;Data Source=primedb;User ID=" & txtUserName.Text & ";Password=" & txtPassword.Text & ";"
msgbox cnstr
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:koolnurd
ID: 12355929
use this

cnstr = "Provider=ORAOLEDB.Oracle;Data Source=primedb;User ID='" & txtUserName.Text & "';Password='" & txtPassword.Text & "';"
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 12357126
Your cn object is not instantiated (no NEW have been used). How is cn is disclared? It should look like this:

dim cn as new adodb.connection

0
 
LVL 1

Author Comment

by:raajbaid
ID: 12357920
Thanks to you all nice guys. The problem was solved. Actually my mistake. I was giving wrong data source.
But now I'm struglling with another. I complied the application with P&DW and when I installed it on another computer, it refused to run with error "Run-time error 3706". Somewhere on net I was suggested to install MDAC and VB6SP5. I installed that too, but the problem persists.

Can anybody give some good solution to this problem.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 12357947
>>The problem was solved
>> but the problem persists.

New problem, No problem, or same problem?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12358592
you need to have MDAC_TYP.EXE in your package. Do you have it?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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