[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

System.Runtime.InteropServices.COM

Posted on 2003-10-27
3
Medium Priority
?
1,129 Views
Last Modified: 2007-12-19
I have this error when I run this code

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in GetOrders.exe

Additional information: Invalid object name 'StaffAccountsDB'.


code:
________________________________________________________
Dim PT_dsCn As String
        Dim PT_dsStr As String
        Dim PT_intX As Integer
        Dim PT_X As Integer
        Dim PT_membersRs As ADODB.Recordset
        Dim PT_cn As New ADODB.Connection()


 PT_cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=nax;Initial _ Catalog=Development;Data Source= " & "myserver1" & ";Password=abcd"
        PT_cn.Open()
        PT_membersRs = New ADODB.Recordset()

        Try

        PT_membersRs.Open("Select * FROM StaffAccountsDB", PT_cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic)

        'Catch
            MsgBox(Err.Number & " " & Err.Description)
________________________________________________________
0
Comment
Question by:paramanj
[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
  • 2
3 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 225 total points
ID: 9629839
This might mean that you have two databases, and are accessing the wrong one, which is missing the StaffAccountsDB table.
0
 

Author Comment

by:paramanj
ID: 9634063
Thanks for the answer, but I have the right database and table name.  It has to be somting else.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 225 total points
ID: 9634213
First a question:  Why use ADO vs. ADO.NET?

Then a suggestion:  Try using ADOX, setup a Catalog, and examine the Tables property to see if the table exists.

Is this a Windows form project in VB.NET?  Does the user have access to the tables?
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 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