Click here to Skip to main content
15,901,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following code in C# ...

SqlConnection thisConnection = new SqlConnection(@"Network Library=DBMSSOCN;Data Source=AZ;database=FMS;User id=fms;Password=password;");

SqlCommand thisCommand = new SqlCommand("D:\\SP\\GetReport.SQL", thisConnection);

thisCommand.CommandType = CommandType.StoredProcedure;

try
{
thisConnection.Open();
SqlDataReader thisReader = thisCommand.ExecuteReader();

...
}


When I run -- the "thisCommand.ExecuteReader throws an exception that states:

"Could Not Find Stored Procedure - 'D:\SP\GetReport.SQL' "

YET - I KNOW THE FILE IS IN THE 'SP' DIRECTORY!

Any advice/help ???

Thanks in advance ...

N
Posted

1 solution

That's not how it works. You thnk SQL Server reads stored procs from your file system ? The stored proc needs to be in the database, then you specify GetReport, or whatever the proc is called, without the other stuff you are using now.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900