locked
Regarding ASP.net applicatin RRS feed

  • Question

  • User-1664020322 posted

     The application is running, but I came across another error which says that the stored procedure is not found. Following is the error:

    System.Data.SqlClient.SqlException: Could not find stored procedure for the solution

    Hello Everyone,

    I'm new to asp.net programming. And I'm facing some issues with stored procedures. The thing is I'm able to access the database, and I see that I have all the stored procedures available in the data base. Can anyone help me out with this issue, any avice or help would be appreciated. Let me know if I have to specify any other information. The following is the error message:

    System.Data.SqlClient.SqlException: Could not find stored procedure for the solution

    Thank You!

    Thank You!

    Regards,

    Sandeep Apsingekar

    Saturday, September 12, 2015 11:56 AM

Answers

  • User753101303 posted

    Hi,

    The message is really "Could not find stored procedure for the solution"? I would expect "Could not find stored procedure 'z'". What is the client side code that triggers that?

    In short, it seems the SP is really not found: the name is really wrong or maybe you are not calling this against the right db or the stored procedure is not even exposed to the account you are using.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 13, 2015 12:35 PM

All replies

  • User281315223 posted

    Assuming that you are targeting the proper database, which sounds like that is working as expected, you should be able to create a command that points to the name of the stored procedure and indicate it is in fact a stored procedure :

    using(var connection = new SqlConnection("Your Connection String"))
    {
          using(var command = new SqlCommand("StoreProcedureName",connection))
          {
                // Open your connection
                connection.Open();
     
                // Indicate it is a stored procedure
                command.CommandType=CommandType.StoredProcedure;
    
                // Add your parameters here
    
                // Execute here using either command.ExecuteNonQuery(), command.ExecuteReader() or command.ExecuteScalar()
          }
    } 

    You need to ensure that the name you are referencing matches your stored procedure exactly to ensure it finds it.

    Saturday, September 12, 2015 12:08 PM
  • User-1664020322 posted

    Hello Everyone,

    I want to know why do we get the stored procedures not found error. Even If we have set of stored procedures available in the database. I'm able to run the application and the database is connected properly, the thing is I'm able to log in to my applications but, when I try to run some stored procedures through my application, that doesn't run. I appreciate the help from this forum so far but want to know why do we actually get this error.

    Saturday, September 12, 2015 12:36 PM
  • User1428246847 posted

    Case sensitivity? E.g

    storedprocedureOne versus StoreprocedureOne?

    Saturday, September 12, 2015 2:01 PM
  • User1603869493 posted

    Hi Sandeep,

    Just i get your problems regarding store procedures are not working properly while you are using applications. First of all you should confirm to check your database connectivity and also check your connection string is in right format. You can check your connection string format as given below.

        <add name="MyConnectionString" connectionString="Data Source=KALUSINGH;Initial Catalog=Movies; User ID=sa;Password=Nothing@123;" providerName="System.Data.SqlClient"/>
    

    One more thing is you should now how to execute your store procedures (SP) in c#.net or vb.net.

     dt = dbhelp.ExecuteDataTable("EXEC GetDetail '" + MovieID+ "'," + CategoryID+ ",'" + Year+ "'," + UserID+ "")

    You can see above code have executed SP with their required arguments. where dbhelp is instance of DataBaseHelper class.

    I hope it code will help you. If you have any problems after it you can email me for get more suggestions.

    Saturday, September 12, 2015 2:11 PM
  • User-1664020322 posted

    Hello!

    Thank you very much for the response. The thing is I'm able to access the database, if connectivity was the issue it won't even allow me to access my asp.net application. But, I'm able to run all other pages, except the pages that are linked to the stored procedures.

    Sunday, September 13, 2015 11:51 AM
  • User-1664020322 posted

    Hello Wim,

    Thank you for the response. I would once cross check the case sensitivity. But, I'm able to execute the stored procedures in sql server management studio, I think there is some other issue.

    Sunday, September 13, 2015 11:53 AM
  • User753101303 posted

    Hi,

    The message is really "Could not find stored procedure for the solution"? I would expect "Could not find stored procedure 'z'". What is the client side code that triggers that?

    In short, it seems the SP is really not found: the name is really wrong or maybe you are not calling this against the right db or the stored procedure is not even exposed to the account you are using.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 13, 2015 12:35 PM
  • User-1664020322 posted

    Hello Everyone,

    Thank you very much for giving all the possible solutions. I got through the issue. It was my fault, I had a typo error in the stored procedure. After looking at all your answers, I went through the code and got the error. Once again Thank you very much.

    Monday, September 14, 2015 11:26 AM