Calling SQL Stored Procedure from C# code

  • Hi guys,

    Looking for some assistance with an MS CRM environment.

    Basically there is a stored procedure on the SQL Sever called Aplan.getpenders

    The C# code which is run as a job on another server has the following code which I assume is calling the above stored procedure.

    var sql = String.IsNullOrEmpty(_p1)

    ? String.Format("exec GetPenders")

    : String.Format("exec GetPenders '{0}'", _p1);

    The rest of the code goes on to generate a letter with the information gathered by the sproc.

    The problem I am having is that there is something I need to change in the letter that is specified in the Sproc pending certain conditions but no matter what I do it does not seem to reflect the changes in the generated email.

    What I have done:

    1. Right click sproc, modify, made the changes, parse and execute - when i click on modify again I can see that the changes have been saved - this does not resolve the issue.

    2. I rebuilt the C# code on the other server - (just trying everything, not sure if its necessary)

    Because the code runs on a different server to the SQL server, I am guessing that the sproc needs to be copied over. The problem is I cannot find the location of the sproc on the SQL server and I cannot find a copy of it on the other server either. Correct me if I am wrong but I need to be looking for a file called GetPenders??? But is it an exe file or an sql file?

    I apologise if that sounds confusing but I have very basic SQL knowledge and less again in C# programming so its all a bit of a maze to me.....

    Any help or suggestions greately appreciated!!

    Thanks

    Ange

  • Got it sorted - lack of knowledge when reading the c# code where it specified the database ..... I was looking at the wrong one!!!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply