Re: Is there a better way to do this

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



well after reading your question and the comments

I guess you could use a BL ( Business Logic ) component , however when
you change the data structure you must change the data logic in the BL
component
you can not get around this , However the big advantage of a BL is that you
only need to change this in one place ( the BL ) and all other projects that
use the BL are automaticly updated when the BL is updated .

if you want more info regarding a BL design i would say investigate a
distributed design pattern, or ask here :-)


regards

Michel Posseth


"kah" <kahsiang.wong@xxxxxxxxx> schreef in bericht
news:1190939342.158701.70370@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Guys,

In my ASP.net application, i am display information using a dataset.
e.g

for each datarow in dataset.table(0).rows
label.text=datarow.item("ColumnName").tostring
next

This works perfectly fine until i have to rename a column in my table.
Obviously the easiest way to make the change is search for all
instance of the Old Column Name and replace it with the New column
Name. However this set me thinking? Is there a better way to do this?

I am thinking of creating a base class with has all the column as the
properties of the table. An another class with is a collection of this
base class. So each time i retrieve a dataset from the db. For each
row of the dataset, i will create a new instance of the base class.
Populate it with the data of that row and add it to the collection.

From there onwards, instead of using the dataset, i can use the
collection class to get all the values.

Am i doing it the right way or is there a better way to go about doing
it?



.



Relevant Pages

  • Re: Managing multiple instances
    ... objects are maintained within a single data structure. ... base class and then adds itself to a data structure of that base class ... instance numbers (that can then be referenced from within client code) ... If you can Ada 95 you could take a look at persistence implementation at my ...
    (comp.object)
  • MustInherit gives a problem
    ... I'm thinking of using Must so I've been reading about it. ... The designer creates an instance of the base class and then runs the ... Initialize method from the current class. ...
    (microsoft.public.dotnet.languages.vb)