Home All Groups Group Topic Archive Search About

SQL Server Express w/ C# 2.0... Cannot find stored procedure...

Author
5 Sep 2006 7:41 AM
den 2005
Hi everybody,

   I created several stored procedure in a local sql server 2005 express
database, now when I call/execute them in the asp.net 2.0 web page, it
returns an error message of "Cannot find the stored procedure '<proc_name>'",
this is funny, when I execute the command in a sql query window "exec
sp_GetAllArticles", it also returns cannot find stored procedure, but when I
execute the "Use <DBName>" and then execute the statement, it works. The sql
connection used in codes is ok.
So, what I have missed to set or where I made mistake?


Code:
Inside web.config,
<add name="Connectstring" connectionString="Data
Source=DENSIA\SQLExpress;Initial Catalog=DbName;Integrated Security=True"
providerName="System.Data.SqlClient" />

inside Load event,

DAL.ConnectionString =
ConfigurationManager.ConnectionStrings["Connectstring"].ConnectionString;

private void DisplayLatestResources()
    {
        DAL.CreateCommand("sp_GetLatestFiveTrainingResources");
        DAL.ExecuteReader();
        SqlDataReader dr = DAL.DataReader;
      .....
    }



Try supplying with user id and password, same result...also try using
aspnet_regsql.exe, same result also...

Thanks in advanced.

den2005


--
MCP Year 2005, Philippines

Author
5 Sep 2006 10:11 AM
ML
Consider naming your objects without the system "sp_" prefix. Are you certain
that you're connecting to the same database both times?


ML

---
http://milambda.blogspot.com/
Are all your drivers up to date? click for free checkup

Author
5 Sep 2006 10:17 AM
ML
I forgot to mention the most important fact: reference your objects using the
schema.object syntax.

=>

Check the procedure's schema (and use it!).
Make sure the user you're using has sufficient (execute) permissions in that
schema.


ML

---
http://milambda.blogspot.com/
Author
6 Sep 2006 1:23 AM
den 2005
Thanks for the reply ML.

Not familiar about schema.object....need to read about this...can you be
more specific by providing me what exactly you meant? Thanks.

den2005


--
MCP Year 2005, Philippines


Show quoteHide quote
"ML" wrote:

> I forgot to mention the most important fact: reference your objects using the
> schema.object syntax.
>
> =>
>
> Check the procedure's schema (and use it!).
> Make sure the user you're using has sufficient (execute) permissions in that
> schema.
>
>
> ML
>
> ---
> http://milambda.blogspot.com/
Author
6 Sep 2006 9:33 AM
ML