Glenn,
Using the SqlCommandBuilder.DeriveParameters() method is what I was going to suggest.We have a method in our DataAccess class for getting parameters this way when we don't know easily what they should be. I discourage using it, because it requires an extra round-trip to the server (for our winform apps), but sometimes it's necessary. Since you're doing ASP.NET, it's still all server side, so not as big a deal (although it still hits the database an extra time).
~~Bonnie
>The development team is "phasing" in a new stored procedure. It currently is being tested with a different name. In the class which calls this SP we need to check which version is being called so that we don't break a web application. The new SP will have two new parameters so the class which calls this SP can test the number of parameters. At some point the new one will replace the old one and we do not want to replace the other components.
>
>BTW this is the technique I cam up with to test the number of parameters thanks to the 4guys at Rolla.com
>
>
>
>Dim myCommand As New SqlCommand
>myCommand.Connection = myConnection
>myCommand.CommandText = stored procedure name
>myCommand.CommandType = Data.CommandType.StoredProcedure
>
>myConnection.Open()
>SqlCommandBuilder.DeriveParameters(myCommand)
>myConnection.Close()
>dim PCount as integer = myCommand.Parameters.count
>
>
>
>
>>>Before calling a StoreProcedure is there any way to know how many parameters are required ?
>>
>>Isn't there an API? Or do the calls vary for some reason?