Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-GB0LHG2\\MSSQLSERVER01;Database=daudFactoryDB;Integrated Security=True");

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO orders (customer,material, quantity, price) values ('" + textBox1.Text + "','" + comboBox2.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')";
            cmd.ExecuteNonQuery();
            ordersdb edb = new ordersdb();

            if (comboBox1.Text == "Delivered")
            {
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "INSERT INTO sales (product,quantity, area, date) values ('" + comboBox2.Text + "','" + textBox5.Text + "','" + comboBox3.Text + "','" + dateTimePicker1.Text + "')";
                cmd.ExecuteNonQuery();

                salesdb sdb = new salesdb();
            }
            comboBox2.Text = "";
            textBox5.Text  = "";
            textBox6.Text  = "";
            //dataGridView2.DataSource = edb.selectal();
            con.Close();
        }
Esempio n. 2
0
        private void Form10_Load(object sender, EventArgs e)
        {
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            TopMost         = false;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Arial", 12);
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            salesdb sdb = new salesdb();

            dataGridView1.DataSource = sdb.selectall();
        }