我有一個整型的List在我得到一定的價值,現在我想通過一個或逗號分隔的所有值傳遞給我的存儲過程之一,如何將int值列表從後面的代碼傳遞給SP?
代碼背後:
Cmd.Parameters.AddWithValue("@ImageId", IDList); //IDList is list of int which need to pass in my SP
在SP
@ImageId int //declaration
IF Not Exists(SELECT ImgIns.Id FROM ImgIns WHERE ImgIns.ImageId [email protected])
如果您想要傳遞逗號分隔列表的替代方法,您還可以將列表序列化爲XML並傳遞XML值。 – Purplegoldfish 2011-12-21 10:27:47