Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void InsertData_Click(object sender, EventArgs e)
- {
- var textboxes = new List<TextBox>() {
- textBox1,
- textBox2,
- textBox3,
- textBox4,
- textBox5,
- textBox6,
- textBox7,
- textBox8,
- textBox9,
- textBox10,
- textBox11,
- textBox12,
- textBox13,
- textBox14,
- textBox15,
- textBox16,
- textBox17,
- textBox18,
- textBox19,
- textBox20
- };
- var labels = new List<Label>() {
- Date2,
- Date4,
- Date6,
- Date8,
- Date10,
- Date12,
- Date14,
- Date16,
- Date18,
- Date20
- };
- SqlCeConnection connection = new SqlCeConnection(@"Data Source=C:UsersFluksikartoNDocumentsVisual Studio 2012ProjectsBuroFokiBuroFokiMainDB.sdf");
- connection.Open();
- for (int i = 0; i < 10 ; i = i++)
- {
- using (SqlCeCommand com = new SqlCeCommand("INSERT INTO TenOperations (EUR, Rate, BGN, Date) Values(@EUR, @Rate, @BGN, @Date)", connection))
- {
- com.Parameters.AddWithValue("@EUR", textboxes[i+1].Text.ToString());
- com.Parameters.AddWithValue("@Rate", EURbuy);
- com.Parameters.AddWithValue("@BGN", textboxes[i].Text.ToString());
- com.Parameters.AddWithValue("@Date", labels[i].Text.ToString());
- com.ExecuteNonQuery();
- }
- }
- connection.Close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement