Many of the stored procedures in may application are set as follows:PROCEDURE MyProc @Action nvarchar(25)AS if @Action = 'Action1' [do stuff] if @Action = 'Action2' [do stuff]
In my code, I call this stored procedure: da.SelectCommand.CommandText = MyProc da.MissingSchemaAction = MissingSchemaAction.AddWithKey da.Fill(ds, "TableName")
The odd behavior is this: The number of tables added to the DataSet is equal to the number of if statements in the stored procedure. What is happening is that the schema associated with each clause is being returned, which implies that when the schema is sought, the if statement is completely ignored.I have tried four variants of this basic methods:1) Use FillSchema versus MissingSchemaAction = MissingSchemaAction.AddWithKey2) Use else if versus if in the stored procedureIs it possible to have the the FillSchema only return the scheme for that section of the store procedure that is of interest?Thank you.