/*Работа с БД*/ private void GetRows() { cap = new CommandAndParams("SEL_Deal_All"); var reader = cap.ExecuteReader(); if (reader.HasRows) { int i = 0; while (reader.Read()) { gridMain.Rows.Add(); gridMain.Rows[i].Cells[0].Value = reader.GetValue(0); gridMain.Rows[i].Cells[1].Value = reader.GetValue(1); gridMain.Rows[i].Cells[2].Value = Convert.ToString(reader.GetValue(2)); gridMain.Rows[i].Cells[3].Value = Convert.ToString(reader.GetValue(3)); gridMain.Rows[i].Cells[4].Value = Convert.ToString(reader.GetValue(4)); gridMain.Rows[i].Cells[5].Value = Convert.ToString(reader.GetValue(5)); gridMain.Rows[i].Cells[6].Value = Convert.ToString(reader.GetValue(6)); gridMain.Rows[i].Cells[7].Value = Convert.ToInt32(reader.GetValue(7)); i += 1; } } reader.Close(); cap.CloseConnection(); cap = null; }
/*Работа с БД*/ private void GetRows() { cap = new CommandAndParams("SEL_Payment_All"); var reader = cap.ExecuteReader(); if (reader.HasRows) { int i = 0; while (reader.Read()) { gridMain.Rows.Add(); gridMain.Rows[i].Cells[0].Value = reader.GetValue(0); gridMain.Rows[i].Cells[1].Value = reader.GetValue(1); gridMain.Rows[i].Cells[2].Value = reader.GetValue(2); gridMain.Rows[i].Cells[3].Value = reader.GetValue(3); gridMain.Rows[i].Cells[4].Value = reader.GetValue(4); gridMain.Rows[i].Cells[5].Value = reader.GetValue(5); gridMain.Rows[i].Cells[6].Value = reader.GetValue(6); gridMain.Rows[i].Cells[7].Value = reader.GetValue(7); gridMain.Rows[i].Cells[8].Value = reader.GetValue(8); gridMain.Rows[i].Cells[9].Value = reader.GetValue(9); gridMain.Rows[i].Cells[10].Value = Convert.ToDecimal(reader.GetValue(10)); i += 1; } } reader.Close(); cap.CloseConnection(); cap = null; }
public void GetRowsMainByID(int DealID) { // выбирает акты только по ид договора cap = new CommandAndParams("SEL_Sales_Main_Check"); cap.AddParam("@DealID", DealID); var reader = cap.ExecuteReader(); if (reader.HasRows) { int i = 0; while (reader.Read()) { gridMain.Rows.Add(); gridMain.Rows[i].Cells[0].Value = Convert.ToInt32(reader.GetValue(0)); gridMain.Rows[i].Cells[1].Value = Convert.ToInt32(reader.GetValue(1)); gridMain.Rows[i].Cells[2].Value = Convert.ToInt32(reader.GetValue(2)); gridMain.Rows[i].Cells[3].Value = Convert.ToInt32(reader.GetValue(3)); gridMain.Rows[i].Cells[4].Value = Convert.ToString(reader.GetValue(4)); gridMain.Rows[i].Cells[5].Value = Convert.ToString(reader.GetValue(5)); gridMain.Rows[i].Cells[6].Value = Convert.ToDateTime(reader.GetValue(6)); gridMain.Rows[i].Cells[7].Value = Convert.ToString(reader.GetValue(7)); gridMain.Rows[i].Cells[8].Value = Convert.ToDateTime(reader.GetValue(8)); gridMain.Rows[i].Cells[9].Value = Convert.ToDecimal(reader.GetValue(9)); gridMain.Rows[i].Cells[10].Value = Convert.ToDecimal(reader.GetValue(10)); gridMain.Rows[i].Cells[11].Value = Convert.ToDecimal(reader.GetValue(11)); i += 1; } } reader.Close(); cap.CloseConnection(); cap = null; }