Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static public DataSet getUserShopItemDS(string username,List<shopItem> items)
- {
- string madeForCommand = "SELECT ItemName as Name,ItemPicture as Picture,ItemHeroModif as Assistance,ItemTroopModif as Charisma, HerbCost as Herbs, GemCost as Gems FROM Item WHERE ItemID = ";
- int count = 0;
- foreach (shopItem item in items)
- {
- madeForCommand += "@value"+count+" OR ";
- count++;
- }
- madeForCommand = madeForCommand.Substring(0, madeForCommand.Length - 3);
- OleDbCommand command = GenerateConnection(madeForCommand);
- for (int i = 0; i < madeForCommand.Length; i++)
- {
- // Checking for each one of the values, and adding the parameters each time.
- if (madeForCommand[i] == '@')
- {
- string substr = "";
- int k=0;
- for (; madeForCommand[i + k] != ' ' && i + k < madeForCommand.Length; k++) ;
- substr = madeForCommand.Substring(i, k); // valueX
- string supersubstr = substr.Substring(6); // X
- int numOutOfSubstr = int.Parse(supersubstr); // the value number itself, which represends the ID of the item for the user.
- command.Parameters.AddWithValue(substr, items[numOutOfSubstr].ID);
- }
- }
- //OleDbCommand command2 = GenerateConnection("SELECT Item FROM ItemPlayerConnection WHERE Player=@Playa AND Inventory=@value");
- //command2.Parameters.AddWithValue("@Playa", username);
- //command2.Parameters.AddWithValue("@value", false);//Looking for shop items, not inventory.
- var FreestyleAdaptor = new OleDbDataAdapter();
- FreestyleAdaptor.SelectCommand = command;
- DataSet Items = new DataSet();
- FreestyleAdaptor.Fill(Items);//The error is thrown here.
- return Items;
- }
- int count = 0;
- foreach (shopItem item in items)
- {
- count += 1;
- madeForCommand += "@value" + count + " OR ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement