开发者

In Silverlight 4 pass multi sellections from one combobox to stored procedure

开发者 https://www.devze.com 2023-03-08 03:39 出处:网络
I am new on developing an application using Silverlight 4 and VS 2010. I need to select one or multi users from a combobox and pass it(them) as parameter to stored proc. My 开发者_如何学Goquestion is

I am new on developing an application using Silverlight 4 and VS 2010. I need to select one or multi users from a combobox and pass it(them) as parameter to stored proc. My 开发者_如何学Goquestion is how to send the user IDs collection as parameter to stored proc?

Thanks.


Passing the data to the back-end shouldn't be terribly problematic: RIA Services and WCF know how to take a list (usually an ObservableCollection) and pass it back and forth between the client and middle tiers. If you've been able to pass other sorts of data back and forth between your client and the middle tier, you shouldn't have any difficulty getting this part to work.

The complexity (such as it is) comes when you need to pass the list from the middle tier to the stored procedure. And unfortunately, there isn't any straightforward way to do this. It's one of the great deficiencies in TSQL, in my opinion.

That said, there are a whole bunch of non-straightforward ways to do it. See http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm for some suggestions. All of these require some sort of special handling of the data before you ever get around to calling the sproc, but with some clever LINQ, that can usually be reduced to just a couple lines of code.

0

精彩评论

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

关注公众号