开发者

Using SqlCommand with SP and without SP Parameteres but just Values in C#

开发者 https://www.devze.com 2023-02-28 21:26 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消