Exemplo n.º 1
0
        private void Expenditure_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();
        }
Exemplo n.º 2
0
        private void Button3_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-H03A9OV;Initial Catalog=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 = "";
            textBox3.Text        = "";
        }
Exemplo n.º 3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-H03A9OV;Initial Catalog=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 + "','" + textBox3.Text + "')";
            cmd.ExecuteNonQuery();
            expendituredb edb = new expendituredb();

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