I am trying to manually create a strongly typed data row
DataSet.PersonRow personRow;
personRow=dataset.Person.NewPersonARow();
personRow.MiddleName=(string)GridView.GetFocusedRowCell("Middlename");
Unable to cast object of type 'System.DBNull' to type 'System.String'. while saving in the database
Loading
Desi GalPosted Aug 17, 2009, 1:45 PM
GridView.GetFocusedRowCellValue("MiddleName") was returning me null inspite of having a valid value.
I trid the same code in the rowUpdated event and it works
Desi GalPosted Aug 17, 2009, 1:24 PM
still
GridView.GetFocusedRowCellValue("MiddleName")!=null gives me a null value in the Debug Mode
Master BillaPosted Aug 17, 2009, 1:15 PM
I think that coulmn is Null value,
so you need check like this way'
if(GridView.GetFocusedRowCell("Middlename") !-=null)
{
personRow.MiddleName=(string)GridView.GetFocusedRowCell("Middlename");
}
thank you
Kirtan PatelPosted Aug 17, 2009, 1:02 PM
string s = System.DBNull.value.ToString();