LoveToCode
MIS
- Jan 11, 2007
- 51
I have a table that looks like this:
ItemID int
SortOrder int
I am using ASP.NET (C#) to update a table, with any given number of rows, to reflect a sort order specified by the user. The problem is if I use a function like this:
and there is 100 items, to call this function over and over it is redundant and obviously there is a much better way to do it.
How can I do a bulk update, without knowing the exact number of params I will need at run time? Can I pass an array or hashtable to SQL or something like that?
Thanks,
-- jenni
ItemID int
SortOrder int
I am using ASP.NET (C#) to update a table, with any given number of rows, to reflect a sort order specified by the user. The problem is if I use a function like this:
Code:
UpdateItem(ItemId, SortOrder) {
SQL = "UPDATE theTable (SortOrder) VALUES (@SortOrder) where ItemID = @ItemID";
}
and there is 100 items, to call this function over and over it is redundant and obviously there is a much better way to do it.
How can I do a bulk update, without knowing the exact number of params I will need at run time? Can I pass an array or hashtable to SQL or something like that?
Thanks,
-- jenni