Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Calling SQL Stored Procedure from C# code Expand / Collapse
Author
Message
Posted Thursday, December 27, 2012 6:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 19, 2013 11:31 PM
Points: 6, Visits: 9
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
Post #1400767
Posted Thursday, December 27, 2012 8:21 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 19, 2013 11:31 PM
Points: 6, Visits: 9
Got it sorted - lack of knowledge when reading the c# code where it specified the database ..... I was looking at the wrong one!!!
Post #1400781
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse