Hello ,
I think one of the Datagridview property
AllowUserToAddRows
is True . Hence when you add rows in your datagridview , a blank row added . Now , when you save the datagridview in your database , the last row obviously null .
I suggest you to write a
For
loop instead of
Foreach
. like this way ..
for(int i=0;i<datagridview1.Rows.Count-1 ; i++ )
{
}
thanks
animesh