Exemple #1
0
 public TablePrintForm(Form parentForm, DataSet ds, string tableName)
 {
     InitializeComponent();
     pForm = parentForm;
     dataGridView.DataSource = ds.Tables[tableName];
     DGVresize.Set(dataGridView);
 }
Exemple #2
0
        private void LoadData()
        {
            try
            {
                sqlDataAdapter  = new SqlDataAdapter("SELECT id_cloth, name, price, length FROM Cloths", sqlConnection);
                sqlDataAdapter1 = new SqlDataAdapter("SELECT id_fittings, name, price, weight FROM Fittings", sqlConnection);

                sqlBuilder  = new SqlCommandBuilder(sqlDataAdapter);
                sqlBuilder1 = new SqlCommandBuilder(sqlDataAdapter1);

                //sqlBuilder.GetInsertCommand();
                //sqlBuilder.GetUpdateCommand();

                //sqlBuilder1.GetInsertCommand();
                //sqlBuilder1.GetUpdateCommand();

                dataSet  = new DataSet();
                dataSet1 = new DataSet();

                sqlDataAdapter.Fill(dataSet, "Cloths");
                sqlDataAdapter1.Fill(dataSet1, "Fittings");

                dataGridView2.DataSource = dataSet.Tables["Cloths"];
                dataGridView1.DataSource = dataSet1.Tables["Fittings"];
                DGVresize.Set(dataGridView1);
                DGVresize.Set(dataGridView2);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }