I take "Index was outside the bounds of the array." error. how can I fix it or how may insert datas from textboxes. is there another way to do it?
protected void Button4_Click(object sender, EventArgs e)
{
string[] nereye = new string[] { TextBox15.Text, TextBox16.Text, TextBox17.Text, TextBox18.Text, TextBox19.Text, TextBox20.Text, TextBox21.Text, TextBox22.Text, TextBox24.Text, TextBox26.Text, TextBox28.Text, TextBox30.Text, TextBox32.Text, TextBox34.Text };
string[] nekadar = new string[] { TextBox8.Text, TextBox9.Text, TextBox10.Text, TextBox11.Text, TextBox12.Text, TextBox13.Text, TextBox14.Text, TextBox23.Text, TextBox25.Text, TextBox27.Text, TextBox29.Text, TextBox31.Text, TextBox33.Text, TextBox35.Text };
baglanti = new SqlConnection("Server=sqlserver;Data Source=elf_hid;Database=onmuhasebe;Integrated Security=SSPI");
SqlCommand sorgu;
sorgu = new SqlCommand();
try
{
baglanti.Open();
sorgu.Connection = baglanti;
for (int i = 0; i <= nereye.Length; i++) {
for (int j = 0; j <= nereye.Length; j++)
{
sorgu.CommandText = "insert into giderler(kime,odeme,toplam,tarih,yol) values ('" + nereye[i] + "','" + nekadar[j] + "','" + TextBox38.Text + "','" + TextBox1.Text + "','" + TextBox37.Text + "')";
}
}
sorgu.ExecuteNonQuery();
baglanti.Close();
}
catch (Exception h)
{
Response.Write(h.Message);
}
}