Step 1: Read in temporary table with query:
SELECT ItemCode, SUM(Qty) as Cnt FROM temp GROUP BY temp.ItemCode
Step 2: While reading values from that query
while(reader.read())
{
string sqlString="UPDATE Count1 SET Cnt=? Where ItemCode=?"
myCommand.Parameters.Add(@"Count",);
myCommand.Parameters.Add(@"ItemCode",);
myCommand.ExecuteNonQuery();
}
I hope this clears it.
[Edit]Below is for SQL Server Sorry about that I missed "Access" tag.
UPDATE [Count] set [Count].[Count] = tmp.cnt FROM (SELECT ItemCode, SUM(Qty) as cnt FROM temp GROUP BY temp.ItemCode) as tmp WHERE [Count].ItemCode=tmp.ItemCode
Advice: Do not give Table/Column names which has other meanings in the database like "Count".