Try:
string query = "Select * from Products where ProductID in ('" + Request.QueryString["ID"].ToString().Substring(1) +"') AND UnitCost < 5000";
The problem lies in this statement:
proid += "," + dr["ProductID"].ToString();
You are putting a comma before every value that is returned. The substring will take everything after the first comma.