Am I doing it right?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

Can someone tell me if I am doing this correctly, or can possibly suggest better ways, if I'm not doing this correctly.

I have a windows application that I am writing,So I have a UI and I have another class that handles the inserts,updates etc to a specific table/s in the database,(I actually have multiple classes that do more or less the same thing, but for different sets of tables in the database) Then in my UI code I have a dataset that I fill by calling a method from one of my classes, that returns a datatable, and I add that table to my dataset in the UI. When I want to add/delete/update data, I do so in the UI's dataset and send the specific datatable in the ui's dataset to the class to update the database. Am I doing this correctly?

I'm sure there is probably a way to cut out the multiple classes for each table or set of tables, like create a base class? but how do I do that? Anyone got any links I can go to for this - if it is a better solution? I did this "multiple classes for tables/sets of tables" because of the layout of the tables, each table of course has different column names, and data types, and there are times when I need to reference a specific column etc.

But overall, am I approaching this correctly? Any insight into streamlining this is greatly appreciated. Thanks alot

Kevin - C# Beginner
 
Hi All

Can someone tell me if I am doing this correctly, or can possibly suggest better ways, if I'm not doing this correctly.

I have a windows application that I am writing,So I have a UI and I have another class that handles the inserts,updates etc to a specific table/s in the database,(I actually have multiple classes that do more or less the same thing, but for different sets of tables in the database) Then in my UI code I have a dataset that I fill by calling a method from one of my classes, that returns a datatable, and I add that table to my dataset in the UI. When I want to add/delete/update data, I do so in the UI's dataset and send the specific datatable in the ui's dataset to the class to update the database. Am I doing this correctly?

I'm sure there is probably a way to cut out the multiple classes for each table or set of tables, like create a base class? but how do I do that? Anyone got any links I can go to for this - if it is a better solution? I did this "multiple classes for tables/sets of tables" because of the layout of the tables, each table of course has different column names, and data types, and there are times when I need to reference a specific column etc.

But overall, am I approaching this correctly? Any insight into streamlining this is greatly appreciated. Thanks alot

Kevin - C# Beginner

Maybe you could have a look at typed datasets.

http://www.c-sharpcorner.com/Code/2004/Jan/TypedDataSets.asp
 
Back
Top