Strongly Typed Datasets, dbNull, and rowstatus

Heiko

Well-known member
Joined
Feb 10, 2003
Messages
430
Location
Holstein, Germany.
Any experts on strongly typed datasets out there ?

We have a strongly typed dataset.

Its contents is being shown in a listview.
The details (single rows) are being shown in a seperate "details" section, both on the same usercontrol.


The user may or may not update some fields, delete rows or add rows.

The entire dataset is then given to a "DataChangeManager" class, that will perform special operations, will also write a history of changes and so on.

So far, so good.



Unfortunately, just to collect data from a single control on the usercontrol back to the dataset, we have to write x lines of code!

Code:
if not DS.isField1Null then
     if DS.Field1 <> control.Text then
            if control.Text = "" then
                DS.Field = dbNull
            else
                DS.Field = control.text
            end if
     end if 
else
   if contol.text <> "" then
      DS.Field = control.text
   end if
end if


That is, of course, pretty much annoying.

But for now, the only alternative I see - with way better generilzation is to use a helper class

Code:
Sub Helper (aControl as control, aDS as Dataset, aTableName as string, aFieldName as String)
which would use the reflection API to adress the correct table and correct row in the DS.
However, this would mean giving up all the benefits of strongly typed datasets! No intellisense. No type checking.

Has anyone ever had a similar problem?

Tnx
Heiko
 
Back
Top