Using SqlCommand with SP and without SP Parameteres but just Values in C#
Hi it's possible to use the SQLCommand to work wi开发者_如何学Goth Stored Procedures but without the need of specify the name of each parameter?
We have always to have the names of SP variables in some collection (like array of strings) to work with the SP?
The common use is this:
sqlComm.Parameters.Add("@name_SP_variable", "some_value");
What i mean if it's possible to do something like this:
sqlComm.Parameters.Add("some_value");
If we just send the right number of parameters and in the right order, can't we just put the values without the name of the variables of the SP?
Take a look at SqlCommand.DeriveParameters()
. This post has an example usage.
精彩评论