This tells me that it's only dropping into your 'if' condition 1 time. Put a breakpoint in your foreach to see why.
Code:
foreach (DataGridViewRow row in dataGridView1.Rows) { // Put breakpoint on line below Console.WriteLine(""); if (!row.IsNewRow) { command.Parameters["@Date"].Value = row.Cells[0].Value.ToString(); command.Parameters["@LogName"].Value = row.Cells[1].Value.ToString(); command.Parameters["@Channel"].Value = row.Cells[2].Value.ToString(); command.Parameters["@DateRecord"].Value = row.Cells[3].Value.ToString(); // Make sure "row.Cells[4].Value" returns a float or convert it before setting the parameter value command.Parameters["@SizeInBytes"].Value = row.Cells[4].Value; command.ExecuteNonQuery(); } }
Comment