Пример #1
0
        private void Expenditure_Type_Load(object sender, EventArgs e)
        {
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            TopMost         = false;
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Arial", 10);
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            ExpenditureTypedb extdb = new ExpenditureTypedb();

            dataGridView1.DataSource = extdb.selectall();
        }
Пример #2
0
 private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
 {
     try
     {
         int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value;
         ExpenditureTypedb exdb = new ExpenditureTypedb();
         DataTable         dt   = exdb.get(id);
         textBox5.Text  = dt.Rows[0]["expenditure_type_id"].ToString().Trim();
         comboBox2.Text = dt.Rows[0]["expenditure_name"].ToString().Trim();
         textBox2.Text  = dt.Rows[0]["Description"].ToString().Trim();
     }
     catch (Exception e1)
     {
         //MessageBox.Show(e1.Message);
     }
 }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=DELL-PC\\SQLEXPRESS;Initial Catalog=NGOIdatabase;Integrated Security=True");

            conn.Open();
            SqlCommand comd = conn.CreateCommand();

            comd.CommandType = CommandType.Text;
            comd.CommandText = "INSERT INTO expenditure_type ( Description, expenditure_name) values ('" + textBox2.Text + "','" + comboBox2.Text + "')";
            comd.ExecuteNonQuery();
            ExpenditureTypedb extdb = new ExpenditureTypedb();

            dataGridView1.DataSource = extdb.selectall();
            conn.Close();
            // textBox5.Text = "";
            textBox2.Text  = "";
            comboBox2.Text = "";
        }