30 Days Photo Challenge: Day Thirty

Nov 10, 2011 20:07

~In motion~

Super Junior @ SMtown Live in Paris - June,10th 2011


private void Form1_Load(object sender, EventArgs e) { OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\andoreia\Documents\Cabinet.accdb"); con.Open(); // OleDbCommand cmd = new OleDbCommand(); // cmd.Connection = con; string query = "SELECT * From Medici"; using (OleDbDataAdapter adapter = new OleDbDataAdapter(query, con)) { DataSet ds = new DataSet(); adapter.Fill(ds); dgvMed.DataSource = ds.Tables[0]; } string query2 = "SELECT * From Pacienti"; using (OleDbDataAdapter adapter2 = new OleDbDataAdapter(query2, con)) { DataSet ds2 = new DataSet(); adapter2.Fill(ds2); dgvPac.DataSource = ds2.Tables[0]; } con.Close(); } private void dgvMed_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void button1_Click(object sender, EventArgs e) { if (!validare()) { OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\andoreia\Documents\Cabinet.accdb"); con.Open(); string ins = "INSERT INTO Retete(retID,retData,medID,pacID,retValoare) VALUES ('" + textBox3.Text + "','" + dateTimePicker1.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + Int32.Parse(textBox4.Text) + "')"; OleDbCommand cmd = new OleDbCommand(ins, con); cmd.ExecuteNonQuery(); con.Close(); this.Close(); } } bool validare() { bool err = false; try { int nr = Int32.Parse(textBox4.Text); errorProvider1.SetError(textBox4, ""); } catch (FormatException) { errorProvider1.SetError(textBox4, "Doar cifre!"); err = true; } return err; }

30 days photo challenge, my world my life

Previous post
Up