tags:

views:

1596

answers:

4

I am maintaining a classic ASP website that has a SQL Server 2005 backend. For a small piece of new functionality I wrote a stored procedure to do an insert. This is the only user stored procedure in the database.

When I attempt to call the stored procedure from code I get the following error:

Microsoft OLE DB Provider for SQL Server error '80040e14' 
Could not find stored procedure 'InsertGroup'. 
/newGroup.asp, line 84 

The DB uses SQL Server authentication. When I connect to the DB server in Visual Studio using the same user/pw as in the connection string the stored procedure is not visible but all tables are.

The user has datareader and datawriter roles and explicit execute permission on the stored procedure.

What am I missing?

UPDATE: My apologies, the server admin misinformed me that it was a 2000 server when it is actually a 2005 server (running on Windows Server 2003 x64).

+4  A: 

You may need to check who the actual owner of the stored procedure is. If it is a specific different user then that could be why you can't access it.

Robin Day
This has happened to me several times and is quite annoying. Open the DB in SQL Server Management Studio if you can and look for 'dbo' or 'youruser' before the stored procedure. If it doesn't have 'dbo.', drop the existing procedure and recreate it with that as a prefix for the procedure name.
Michael Haren
Or, just mention the "owner" (="schema") the stored procedure belongs to as part of the call -- EXEC [dbo].[InsertGroup]
Tomalak
it's dbo.InsertGroup
Chloraphil
calling it as dbo.InsertGroup or just InsertGroup fails
Chloraphil
Fails in what way? If it is an access denied error, GRANTing the user you are accessing the database with EXECUTE to dbo.InsertGroup would fix it.
Tomalak
Sorry; it fails as before, same error message.
Chloraphil
A: 

You mentioned that

When I connect to the DB server in Visual Studio using the same user/pw as in the connection string the stored procedure is not visible but all tables are.

You need to see who the owner of the stored procedure is and change it to match what you are using to connect in code.

kevchadders
A: 

make sure that your schema name is in the connection string?

DForck42
can you be more specific? I'm not familiar with how to do that. Regardless, the database is only using the "dbo" schema.
Chloraphil
+3  A: 

Walk of shame:

The connection string was pointing at the live database. The error message was completely accurate - the stored procedure was only present in the dev DB. Thanks to all who provided excellent answers, and my apologies for wasting your time.

Chloraphil
You should probably mark this as the answer, to help others who may not read to the bottom.It's great that you posted this. I'm sure others have done and will do similar things, and an example of an oversight like this will probably help somebody else find his error.
GilM
@Chloraphil: It's always funny to see that developers tend to think that the most probable explanation is not worth consideration, exploring everything else beforehand. :) +1 for providing the cause of the problem.
Tomalak
I have to wait 48 hours before I can mark this as the answer
Chloraphil