リストボックスから選択した複数の値をasp.net c#のデータベースに保存するコードを誰でも提案できますか
string day = dataGridView1.Rows[0].Cells[0].Value.ToString();
//DateTime.Now.DayOfWeek.ToString();
dataGridView1.Rows[0].Cells[1].Value =
Convert.ToDateTime(day.ToString())).DayOfWeek.ToString();
for (int i = 1; i < 10; i++)
{
DateTime dtd = Convert.ToDateTime(day).Date;
dtd = dtd.AddDays(7);
dataGridView1.Rows[i].Cells[0].Value = dtd;
DateTime date = dtd;
dataGridView1.Rows[i ].Cells[1].Value =
(Convert.ToDateTime(date.ToString())).DayOfWeek.ToString();
}
}
エラー
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index.