Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many parameters are required?
Message
De
19/11/2008 19:02:45
 
 
À
19/11/2008 16:36:11
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01362900
Message ID:
01363012
Vues:
12
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?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform