private void metroButton1_Click_1(object sender, EventArgs e) { int tmp = MembersFee.CustomerId(); string q = "INSERT INTO subscriptions(customer_id,start_date,end_date,package,cost,paid) VALUES(" + tmp + ",'" + startDate.Value.ToString() + "','" + endDate.Value.ToString() + "','" + monthTB.Text + "','" + double.Parse(costTB.Text) + "','" + payTB.Text + "')"; executeQuery(q); rerfeshGrid(); }
private void rerfeshGrid() { try { String q2 = "select * from subscriptions"; q2 += " where customer_id='"; q2 += MembersFee.CustomerId().ToString() + "'"; da2 = new MySqlDataAdapter(q2, MainForm.connection); ds2.Clear(); da2.Fill(ds2, "Subscriptions"); dataGridView1.DataSource = ds2.Tables["Subscriptions"]; } catch (Exception ex) { MetroMessageBox.Show(this, "Error", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }