Guest User

Untitled

a guest
Dec 31st, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 KB | None | 0 0
  1.  int lastRow = 0;
  2.  
  3.                     dataGridView1.Columns.Add("nomenclature_id", "код номенклатуры");
  4.                     dataGridView1.Columns.Add("name", "наименование");
  5.                     dataGridView1.Columns.Add("price", "цена");
  6.                     dataGridView1.Columns.Add("availiable_amount", "в наличии");
  7.                     dataGridView1.Columns.Add("warehouse_number", "# склада");
  8.  
  9.                     connection.Open();
  10.                     for (int count = 1; count <= wh_count; count++)
  11.                     {
  12.                         MySqlCommand getTable = new MySqlCommand("SELECT availiable_nomenclature.nomenclature_id, name, price, availiable_amount, warehouse_number FROM availiable_nomenclature INNER JOIN nomenclature ON availiable_nomenclature.nomenclature_id = nomenclature.nomenclature_id WHERE warehouse_number =" + count.ToString(), connection);
  13.                         MySqlDataAdapter da = new MySqlDataAdapter();
  14.                         da.SelectCommand = getTable;
  15.                         DataSet ds = new DataSet();
  16.                         da.Fill(ds,"AVNOM");
  17.                         int row = ds.Tables["AVNOM"].Rows.Count - 1;
  18.                         for (int r = lastRow; r <= lastRow + row; r++)
  19.                         {
  20.                             dataGridView1.Rows.Add();
  21.                             dataGridView1.Rows[r].Cells[0].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[0];
  22.                             dataGridView1.Rows[r].Cells[1].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[1];
  23.                             dataGridView1.Rows[r].Cells[2].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[2];
  24.                             dataGridView1.Rows[r].Cells[3].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[3];
  25.                             dataGridView1.Rows[r].Cells[4].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[4];
  26.                         }
  27.                         lastRow += row;
  28.                     }
  29.                     connection.Close();
Advertisement
Add Comment
Please, Sign In to add comment