I am creating a small Windows application using Visual C# 2005 Express
Edition (August CTP) for a small non-profit agency. My current issue is
with updating related information in an Access database. The individual
records are being saved to the database with a few issues...
Notes:
1) I was going to post the source code from a test program I developed
for testing these issues, but it made for a messy post. Here is a link
to a zip file that contains the project files:
http://csharphelp.tripod.com/Files/FamilyTest.zip
2) I had initially implemented the SetEventForIden tity methods to get
retrieve the AutoNumber values after the rows were added, but I don’t
think that was really needed.
3) Despite the fact that I own Visual Studio 2003, I decided to create
this application using Visual C# 2005 Express Edition because of the
many enhancements Microsoft has made to their data binding technology.
It is for that reason that I hope to find a solution that leverages the
power of the new development framework. While the sample application
that demonstrates the above issue is very basic, the actual application
contains 20 tables with many fields, extensive business logic, and
complex forms. Developing using the Visual Studio 2003 style data
bindings in C# 2005 would needlessly complicate an already convoluted
program. :-)
Issues:
1) When starting with an empty database, the 'FamilyId' value is not
being saved to the 'Person' table. This part of the program seems to
work after at least one record has been been saved. I would like my
customer to be able to successfully save related rows to an empty database.
2) The line that sets the 'personBindingS ource.DataSourc e' to the
'familyBindingS ource' generates an exception -- "Cannot bind to the
property or column Name on the DataSource Parameter name: dataMember".
I have been able to workaround this issue by adding some exception
handling, but as you can see by looking at the the code, this isn't an
elegant solution. My programming style is to write code that utilizes
as few workarounds as possible!