Hello, Everyone.
I am using Sql Management Objects (SMO) in Visual Studio 2012 C#.
I am attempting to instantiate a new StoredProcedure object from the db.StoredProcedures Collection.
When I try to find a stored procedure in the [dbo] schema. It works fine.
When I try to do this for a stored procedure in another schema (my other schema is called EA), it will not find the sproc.
I know that the stored procedures from other schemas are in the list because I can access them by index.
I tried qualifying the name better to no avail using EA.MyEASprocName, [EA].[MyEASprocName], and {[EA].[MyEASprocName]}
I have no way of knowing the index beforehand. I just added a stop point and watch point and scrolled through the collection. That's how I was able to find the index number for the example.
Any insights on what the SMO is doing here would be greatly appreciated.
Thanks.
Patrick B
I am using Sql Management Objects (SMO) in Visual Studio 2012 C#.
I am attempting to instantiate a new StoredProcedure object from the db.StoredProcedures Collection.
When I try to find a stored procedure in the [dbo] schema. It works fine.
Code:
StoredProcedure sproc = db.StoredProcedures["MyDboSprocName"];
When I try to do this for a stored procedure in another schema (my other schema is called EA), it will not find the sproc.
Code:
StoredProcedure sproc = db.StoredProcedures["MyEASprocName"]; //sproc = null.
I know that the stored procedures from other schemas are in the list because I can access them by index.
Code:
StoredProcedure sproc = db.StoredProcedures[195]; // this is the sproc I am looking for "MyEASprocName"
I tried qualifying the name better to no avail using EA.MyEASprocName, [EA].[MyEASprocName], and {[EA].[MyEASprocName]}
I have no way of knowing the index beforehand. I just added a stop point and watch point and scrolled through the collection. That's how I was able to find the index number for the example.
Any insights on what the SMO is doing here would be greatly appreciated.
Thanks.
Patrick B