在按钮上单击 Table 中许多控件中的插入多个(文本框和标签)文本

On button click INSERT multiple (textbox and label) texts from many controls inside Table

我创建了 table "TenOperations",其中有 4 列 "EUR" 类型实数,"Rate" 类型实数,"BGN" 类型实数,"Date" 输入 nvarchar

在按钮上单击我试图从所有填充的文本框和标签中插入数据,以便:

第一行应该是

 textbox1.text , Rate , textbox2.text , Date2.text

第二行应该是

 textbox3.text , Rate , textbox4.text , Date4.text

等等

Rate 是全局双变量,Date2 是标签,当 textbox2.text 改变时,它的文本也会改变。

问题是我的这段代码创建了具有相等值的无限行

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:\Users\FluksikartoN\Documents\Visual Studio 2012\Projects\BuroFoki\BuroFoki\MainDB.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();
        }
for (int i = 0; i < 10 ; i = i++)

应该是

for (int i = 0; i < 10 ;i++)