LINQ to Stored Procedure. Can I call the SP with a dynamic list of parameters instead of strongly typing them?

The ExecuteCommand and ExecuteQuery methods of the DataContext class take a simple parameter ( params object ) array. There are a few gotchas when it comes to those, but for the most part they work fine and are less code to write than populating the parameters of a SqlCommand context. ExecuteCommand("EXEC usp_UpdateProductName {0}, {1}", productID, productName) That's all there really is to it.

The ExecuteCommand and ExecuteQuery methods of the DataContext class take a simple parameter (params object) array. There are a few gotchas when it comes to those, but for the most part they work fine and are less code to write than populating the parameters of a SqlCommand. Context.

ExecuteCommand("EXEC usp_UpdateProductName {0}, {1}", productID, productName); That's all there really is to it.

You could have your sp take in an xml data type parameter and you could loop through and dynamically create the value of that parameter. Then the stored proc would know what to expect in the xml parameter....that is a way to pass in a variable length parameter into the database.

There are a few gotchas when it comes to those, but for the most part they work fine and are less code to write than populating the parameters of a SqlCommand. That's all there really is to it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions