Ne mozes ovako. Jedina SQL komanda koja tebi moze da odradi ovaj posao je:
Code:
SELECT ProductID, SUM (Quantity)
FROM [Order Details]
WHERE OrderID IN ('10249', 'itd', 'itd', 'koliko', 'hoces', 'elemenata')
GROUP BY ProductID
Problem je sto je ova struktura nekompatibilna sa parametrima stored procedure (gornja lista se ne moze proslediti kao parametar). Imas tri alternative:
1. Da ne koristis stored proceduru nego da dinamicki odredis gornji SQL i izvrisis kroz adapter/command, kako vec hoces
2. Da sacekas Orca-u i da iskoristis DLINQ for DataSet da odradis svoju naknadnu agregaciju nakon x poziva stored procedure za svaki red posebno.
3. Da radis softverski agregaciju nad tvojim datasetom (vidi pseudokod), nakon x poziva stored procedure za svaki red posebno:
Code:
foreach (red1 in tabela1.Rows)
{
if tabela2.sadrziKljuc(red1.productid)
tabela2.Red(red1.productid).Quantity += red1.Quantity
else
tabela2.DodajRed(red1.productid, red1.Quantity)
}
Prava c# sintaksa je drugacija, ne znam napamet i nemam VS sad, trebalo bi da se lako snadjes sa ovim psudo kodom.
▪ "Why isn't my wireless mouse connected to the computer?" - 2008 Dumbest Technical Support Question
▪ The word 'politics' is derived from the word 'poly', meaning 'many', and the word 'ticks', meaning 'blood sucking parasites' - Hardiman
▪ If the good guy gets the girl, it's rated PG; if the bad guy gets the girl, it's rated R; and if everybody gets the girl, it's rated X