locked
Cannot find stored procedure RRS feed

  • Question

  • User-46685695 posted

    I have a VB.net module which works under Dotnetnuke. I had to change the Sql script as I had to draw values from three separate columns and display them in one column, so I wrote a stored procedure to do it. Once I had finished it, I went to the Gridview and amended the datasource to use the stored procedure instead of the sql script. However, when I went to use the module, I get an error like the one below -

    DotNetNuke.Services.Exceptions.ModuleLoadException: Could not find stored procedure ''. ---> System.Data.SqlClient.SqlException: Could not find stored procedure ''. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.GridView.DataBind() at YourCompany.Modules.TherapeuticGroups.ViewTherapeuticGroups.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---


    The connection string is correct, so I cannot understand why DNN cannot find it.

    Tuesday, February 8, 2011 5:10 AM

Answers

  • User-1412735316 posted

    try to get data from tables just to check whether the problem is only for SP.

    Would you mind checking the spelling of SP again.

    You may mail your codes at kmnur@hotmail.com if you feel comfortable.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 8, 2011 9:53 AM

All replies

  • User2004711764 posted

    Did you qualified your stored procedure name with schema name?


    What's your stored procedure full name and how you call it?


    Morzel

    Tuesday, February 8, 2011 6:41 AM
  • User-46685695 posted

    Thanks for your reply. I added the stored procedure in the Configure Data Source wizard and tested it on the last tab which works fine. This is how the asp.net source code looks -

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"
        SelectCommand="GetTherapeuticGroups" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>

    The stored procedure is called "GetTherapeuticGroups"


    Tuesday, February 8, 2011 6:55 AM
  • User2004711764 posted

    Have you tried to qualify stored procedure name with schema?

    For example 'dbo.GetTherapeuticGroups' instead of 'GetTherapeuticGroups'?


    Morzel

    Tuesday, February 8, 2011 7:34 AM
  • User-46685695 posted

    I tried renaming as dbo.therapeuticgroups and still got the same arror.


    Tuesday, February 8, 2011 7:51 AM
  • User-1412735316 posted

    have you tried a simple thing? is there any possibility that you have created the SP in a seperat database than what you are currently using? Or if you have several server than may be in another one with same db name.

    Is your stored procedure's access is secured with any username?

    Tuesday, February 8, 2011 9:15 AM
  • User-46685695 posted

    I have created the datasource using the 'Configure Data Source' wizard in Visual Studio, where you first select the connection string and then select either sql script or stored procedure. If you select the latter you then select the SP from a list. Once you have done that you can test the SP before saving. Everything works fine up to this point, when I run the web page that is when I get the error.


    Tuesday, February 8, 2011 9:39 AM
  • User-1412735316 posted

    try to get data from tables just to check whether the problem is only for SP.

    Would you mind checking the spelling of SP again.

    You may mail your codes at kmnur@hotmail.com if you feel comfortable.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 8, 2011 9:53 AM
  • User-46685695 posted

    Thanks Shuvo, I've emailed the source and script for the SP. I would really appreciate your help in resolving this.


    Tuesday, February 8, 2011 11:52 AM