0
데이터베이스의 테이블을 업데이트하고 있지만 지속적으로 예외가 발생합니다. NullReferenceException "개체 참조가 개체의 인스턴스로 설정되지 않았습니다."테이블 업데이트 중 예외 가져 오기
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
double bal_due, a, b;
a = double.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString()); //this lines throws the exception
b= double.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());
bal_due = a - b;
string var = string.Format(
"update purchase_order set paid_today={0}, " +
"balance_due={1} where order_no={2}",
dataGridView1.Rows[i].Cells[4].Value, bal_due, comboBox2.SelectedValue);
obj.query(var);
}
뭔가 잘못되었습니다. 어떤 라인이 예외를 던집니까? – Blorgbeard
@ Blorgbeard ... 내가 업데이트 한 코드를 확인하십시오 –
Cells [3] .Value는 아마도 null이고 ToString을 호출하고 있습니다. – DeveloperGuo