public void getBrandData(out CategorysAndBrand[] Cat_Array) { sqlCommandAB brandSql = new sqlCommandAB(); DataTable DT = brandSql.QueryDT("SELECT * FROM Brand"); int rowCount = DT.Rows.Count; Cat_Array = new CategorysAndBrand[rowCount]; string[] row; for (int j = 0; j < rowCount; j++) { row = new string[] { (string)DT.Rows[j]["brandName"], (string)DT.Rows[j]["categoryName"], (string)DT.Rows[j]["brandDescription"] }; dataGridView2.Rows.Add(row); } }
public void getBrandData(out CategorysAndBrand[] Cat_Array, string category) { comboBox1.Items.Clear(); sqlCommandAB brandSql = new sqlCommandAB(); DataTable DT = brandSql.QueryDT("SELECT * FROM Brand WHERE categoryName= '" + category + "' "); int rowCount = DT.Rows.Count; Cat_Array = new CategorysAndBrand[rowCount]; string[] row; for (int j = 0; j < rowCount; j++) { row = new string[] { (string)DT.Rows[j]["brandName"], (string)DT.Rows[j]["brandDescription"] }; comboBox1.Items.Add(DT.Rows[j]["brandName"]); } }
public void getCatData(out CategorysAndBrand[] Cat_Array) { selectCat.Items.Clear(); sqlCommandAB brandSql = new sqlCommandAB(); DataTable DT = brandSql.QueryDT("SELECT * FROM Category"); int rowCount = DT.Rows.Count; Cat_Array = new CategorysAndBrand[rowCount]; string[] row; for (int j = 0; j < rowCount; j++) { row = new string[] { (string)DT.Rows[j]["categoryName"], (string)DT.Rows[j]["categoryDescription"] }; dataGridView1.Rows.Add(row); selectCat.Items.Add(DT.Rows[j]["categoryName"]); } selectCat.SelectedIndex = -1; }