There are 2 causes:
1- store procedure name When you declare store procedure in code make sure you do not exec or execute keyword for example:
C#
string sqlstr="sp_getAllcustomers";// right way to declare it.
string sqlstr="execute sp_getAllCustomers";//wrong way and you will get that error message.
From this code:
MSDBHelp.ExecuteNonQuery(sqlconexec, CommandType.StoredProcedure, sqlexec);
CommandType.StoreProcedure
will look for only store procedure name and ExecuteNonQuery
will execute the store procedure behind the scene.
2- connection string:
Another cause is the wrong connection string. Look inside the connection string and make sure you have the connection especially the database name and so on.
Check if you are using Windows Authentication or SQL Server authetication