Hello and sorry for my bad english, I'm working with C# Firebase I have a problem with retrieving data
My database is here;
[-] "Product":
[-] "1":
Brand: "Y Brand"
BuyPrice: "1500$"
Category: "Software"
Id: "22"
InStock: "15"
Model: "x1500"
SellPrice: "1600$"
SerialNumber: "4564564654"
[-] "2":
Brand: "X Brand"
BuyPrice: "1500$"
Category: "Hardware"
Id: "245"
InStock: "45"
Model: "x1600"
SellPrice: "1700$"
SerialNumber: "46848564654"
(I can't post images because I need 10 least reputation sorry)
this code retrieving datas in "Products/" + int but I couldn't get Product title
try
{
i++;
con.resp = await con.client.GetAsync("Product/" + i);
Product prdct = con.resp.ResultAs<Product>();
DataRow row = dt.NewRow();
row["ID"] = prdct.Id;
id = prdct.Id;
row["Kategori"] = prdct.Category;
row["Marka"] = prdct.Brand;
row["Model"] = prdct.Model;
row["Stok"] = prdct.InStock;
row["Alış Fiyatı"] = prdct.BuyPrice;
row["Satış Fiyatı"] = prdct.SellPrice;
row["Seri Numarası"] = prdct.SerialNumber;
dt.Rows.Add(row);
tolerance = 0;
}
How I get this titles? Like in Access or Sql (Select ID from Product)
[-] "Product":
[+] "1"
[+] "2"
I've solved this problem with this:
Database:
[-] "Products":
[-] "All":
Brand: "X Brand,Y Brand"
BuyPrice: "1500$,1600$"
Category: "Software,Hardware"
Id: "22,23"
InStock: "15,1675"
Model: "x1500,x1600"
SellPrice: "1600$,1700$"
SerialNumber: "123,123"
I could get this datas and export to "string[] id, string[] brand" for every single child then code of below gets all datas under 1 second
Product prdct = con.resp.ResultAs<Product>();
getID = prdct.Id.Split(',');
getCategory = prdct.Category.Split(',');
getBrand = prdct.Brand.Split(',');
getModel = prdct.Model.Split(',');
getSellPrice = prdct.SellPrice.Split(',');
getBuyPrice = prdct.BuyPrice.Split(',');
getInStock = prdct.InStock.Split(',');
getSerialNumber = prdct.SerialNumber.Split(',');
try
{
for (int i = 0; i < GetID.Length; i++)
{
DataRow row = dt.NewRow();
row["ID"] = GetID.GetValue(i);
row["Kategori"] = getCategory.GetValue(i);
row["Marka"] = GetBrand.GetValue(i);
row["Model"] = GetModel.GetValue(i);
row["Stok"] = GetInStock.GetValue(i);
row["Alış Fiyatı"] = GetBuyPrice.GetValue(i);
row["Satış Fiyatı"] = GetSellPrice.GetValue(i);
row["Seri Numarası"] = getSerialNumber.GetValue(i);
dt.Rows.Add(row);
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.