Solved

System.Runtime.InteropServices.COM

Posted on 2003-10-27
3
1,113 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
  • 2
3 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 75 total points
Comment Utility
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
Comment Utility
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 75 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now