예제 #1
0
        private void Expenditures_Load(object sender, EventArgs e)
        {
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            TopMost         = false;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Arial", 10);
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            expendituredb exdb = new expendituredb();

            dataGridView1.DataSource = exdb.selectall();
        }
예제 #2
0
        private void button4_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 = "delete from expenditures where Name='" + textBox1.Text + "'";
            cmd.ExecuteNonQuery();
            expendituredb rdb = new expendituredb();

            dataGridView1.DataSource = rdb.selectall();
            con.Close();
            textBox1.Text        = "";
            textBox2.Text        = "";
            dateTimePicker1.Text = "";
            textBox4.Text        = "";
        }
예제 #3
0
        private void button1_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 expenditures (Name, amount, date, expenditure_for) values ('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox4.Text + "')";
            cmd.ExecuteNonQuery();
            expendituredb edb = new expendituredb();

            dataGridView1.DataSource = edb.selectall();
            con.Close();
            textBox1.Text = "";
            textBox2.Text = "";
            //textBox3.Text = "";
            textBox4.Text = "";
        }