Hi,
this error are getting may be because the value
"dt.Rows[0][0].ToString()"
is not valid for Int32. check the value in it and also check for DBNull value. if every thing is valid then try to assign to cell.
try this,
int check;
if(int.TryParse(dt.Rows[0][0].ToString(), out check))
{
DataGrid.CurrentCell.Value = dt.Rows[0][0].ToString();
}
else
DataGrid.CurrentCell.Value = 0;
hope it helps.