Gustav Brock
Gustav at cactus.dk
Sun Apr 5 16:57:22 CDT 2009
Hi Shamil In your OrdersForm you write: /// <summary> /// Custom class to get Customer row attributes. /// This class is required to suppress exceptions /// caused by DbNull values of row fields. /// Note: if you know better method to workaround this /// issue please make a change here but leave the old code /// cpmmented. Thank you. /// </summary> private class customerAttributes { private Northwind.NET.FE.Datasets.OrdersFormDataSet.CustomerRow _row; public customerAttributes(OrdersForm form, int customerId) { Northwind.NET.FE.Datasets.OrdersFormDataSet.CustomerRow row = form.ordersFormDataSet.Customer.FindByID(customerId); _row = row; } public int? ID { get { try { return _row.ID; } catch { } return null; } } public string Name { get { try { return _row.Name; } catch { } return null; } } public string Address { get { try { return _row.Address; } catch { } return null; } } public string Region { get { try { return _row.Region; } catch { } return null; } } public string City { get { try { return _row.City; } catch { } return null; } } public string PostalCode { get { try { return _row.PostalCode; } catch { } return null; } } public string Country { get { try { return _row.Country; } catch { } return null; } } } I haven't tested it here, but until now I have managed this by selecting properties of each field/column in question (in the view of the xsd file), pick property NullValue and change the value from the default value of (Throw exception) to (Null). This can still cause trouble in the code. But to avoid that, a property is created for these colums, IsColumnNull, as well as a method to set it to Null, SetColumnNull(). /gustav