?
Solved

System.Runtime.InteropServices.COM

Posted on 2003-10-27
3
Medium Priority
?
1,121 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

752 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