Akash

Akash

  • NA
  • 11
  • 0

Is there alternative to use dbSchemaName.StoreProcedureName in ADO.NET?

Dec 7 2007 9:51 AM

DAL -

SqlConnection con = new SqlConnection(conPath);
SqlCommand cmd = new SqlCommand("School.usp_GetSchoolName", con);

SQL 2005
-StoreProcedure : I have schema named School and usp_GetSchoolName is saved like this.

School.usp_GetSchoolName.

Here is my problem -
I have put about 44 StoreProcedures inside this new container called School Schema. In my ADO.NET ((data access tier) I am passing storeprocedureName and Connection information without SchemaName.  When I do this it says storeprocedure is not found. If I go and supply the School.usp_GetSchoolName then it works.  I do not feel it is a right practice to supply schemaName in every storeprocedure in ADO.NET.  Does anyone have any suggestions?  My storeprocedures are divided into many schemas such as School, Student, Administrative, Sports.


Answers (2)