grip003
Well-known member
This is an open thread to general thoughts and ideas about programming and interacting with a database.
I have been developing windows applications that rely on a database for the past few years. I am the only developer for the company I work for, so I dont have anyone to bounce ideas off of. I got some experience in college and graduate school, but I dont seem to have the time to just play around with different programming ideas. I seem to always need to be productive. So, I wanted to see how other programmers design and implement applications that communicate with a database.
Currently, I dont like to rely on binding any fields to a DataTable. I usually write a SetupFields function that loads the windows form fields with the appropriate information based on the current row in the datatable that the user has chosen. I allow the user to edit the fields, and when they click Save, then I validate all fields manually (make sure monetary fields are formatted correctly, etc.) and the create an UPDATE (or INSERT INTO for a new record) statement and send that to the database. Then I update the datatable locally and continue. Ive been wondering about writing classes for each table in the database and having each class be responsible for data retrieval and updates. Is this a good idea? What about validation? It seems like I am always writing validation/updating code to make changes in my database. Is there a better way to do this?
I would just like to hear other stories and comments about database programming from other experienced programmers. I program in C#, but I also have some legacy applications that were written in VB6. My applications seem to work, I just want to be a better programmer.
I have been developing windows applications that rely on a database for the past few years. I am the only developer for the company I work for, so I dont have anyone to bounce ideas off of. I got some experience in college and graduate school, but I dont seem to have the time to just play around with different programming ideas. I seem to always need to be productive. So, I wanted to see how other programmers design and implement applications that communicate with a database.
Currently, I dont like to rely on binding any fields to a DataTable. I usually write a SetupFields function that loads the windows form fields with the appropriate information based on the current row in the datatable that the user has chosen. I allow the user to edit the fields, and when they click Save, then I validate all fields manually (make sure monetary fields are formatted correctly, etc.) and the create an UPDATE (or INSERT INTO for a new record) statement and send that to the database. Then I update the datatable locally and continue. Ive been wondering about writing classes for each table in the database and having each class be responsible for data retrieval and updates. Is this a good idea? What about validation? It seems like I am always writing validation/updating code to make changes in my database. Is there a better way to do this?
I would just like to hear other stories and comments about database programming from other experienced programmers. I program in C#, but I also have some legacy applications that were written in VB6. My applications seem to work, I just want to be a better programmer.