Invalid Object Name error. What is this referring to?

D

darrel

I'm trying to delete a record in a table:

Dim strConnect As String =
System.Configuration.ConfigurationSettings.AppSettings("myConnectionString")
Dim strChk = "DELETE FROM we_admin_users WHERE UserID='" & myUserID & "'"
Dim objConnect As New System.Data.OleDb.OleDbConnection(strConnect)
objConnect.Open()
Dim objCommand As New System.Data.OleDb.OleDbCommand(strChk, objConnect)
objCommand.ExecuteNonQuery()

objConnect.Close()
objCommand.Dispose()

But when I run this, I get this error:

" Invalid object name 'we_admin_users' "

I can run this same function against a different table, and it executes
fine. I can also take the query from above and use it directly in Enterprise
Manager, and it executes fine. Both tables have the same permissions.

So, I'm stumped as to what it things the problem is. What else should I look
at?

-Darrel
 
B

Bruce Barker

the error means the table we_admin_users in the delete does not exists.
check that the connect string references the correct server and database.

-- bruce (sqlwork.com)
 
D

darrel

the error means the table we_admin_users in the delete does not exists.
check that the connect string references the correct server and database.

It does exist. I can put the exact same query into Enterprise Manager and it
runs fine.

It also uses the same connection string as the other function I'm calling,
which deletes from another table, which also works fine.

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top