Hi All,

I have the following Code:

Code:
                SqlDataReader locationBuildings = command.ExecuteReader();
                LocalLocationBuildings = new List<LocationBuilding>();
                while (locationBuildings.Read())
                {
                    LocationBuilding locationBuilding = new LocationBuilding();

                    locationBuilding.PolicyLocationID = (Int32)locationBuildings.GetSqlInt32(0);
                    locationBuilding.LocationCode = locationBuildings.GetString(1);
                    locationBuilding.LocationName = locationBuildings.GetString(2);
                    locationBuilding.LocationPostCode = locationBuildings.GetString(3);
                    if (!Convert.IsDBNull(locationBuildings.GetValue(4))) { locationBuilding.PolicyLocationBuildingID = (Int32)locationBuildings.GetValue(4); }
                    if (!Convert.IsDBNull(locationBuildings.GetValue(5))) { locationBuilding.BuildingCode = (Char)locationBuildings.GetValue(5); }
                    if (!Convert.IsDBNull(locationBuildings.GetValue(6))) { locationBuilding.BuildingName = locationBuildings.GetValue(6).ToString(); }
                    if (!Convert.IsDBNull(locationBuildings.GetValue(7))) { locationBuilding.BuildingPostcode = locationBuildings.GetValue(7).ToString(); }
                    locationBuilding.MaintainBuildings = locationBuildings.GetChar(8);
                    LocalLocationBuildings.Add(locationBuilding);
                }
                locationBuildings.Close();
                close();
            }
My code fails with the above error on the highlighted line. The locationBuilding.MaintainBuildings has been declared as Char and the underlying table column for the value returned is declared as Char(1) not null.
there is no conversion in the sp returning the value it's a straight forward select from statement. Anybody any Ideas?

Thanks