Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int lastRow = 0;
- dataGridView1.Columns.Add("nomenclature_id", "код номенклатуры");
- dataGridView1.Columns.Add("name", "наименование");
- dataGridView1.Columns.Add("price", "цена");
- dataGridView1.Columns.Add("availiable_amount", "в наличии");
- dataGridView1.Columns.Add("warehouse_number", "# склада");
- connection.Open();
- for (int count = 1; count <= wh_count; count++)
- {
- 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);
- MySqlDataAdapter da = new MySqlDataAdapter();
- da.SelectCommand = getTable;
- DataSet ds = new DataSet();
- da.Fill(ds,"AVNOM");
- int row = ds.Tables["AVNOM"].Rows.Count - 1;
- for (int r = lastRow; r <= lastRow + row; r++)
- {
- dataGridView1.Rows.Add();
- dataGridView1.Rows[r].Cells[0].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[0];
- dataGridView1.Rows[r].Cells[1].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[1];
- dataGridView1.Rows[r].Cells[2].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[2];
- dataGridView1.Rows[r].Cells[3].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[3];
- dataGridView1.Rows[r].Cells[4].Value = ds.Tables["AVNOM"].Rows[r].ItemArray[4];
- }
- lastRow += row;
- }
- connection.Close();
Advertisement
Add Comment
Please, Sign In to add comment