todonnell69
Member
- Joined
- Jun 8, 2005
- Messages
- 15
- Programming Experience
- 5-10
Sorry if this is posted in the wrong forum, not sure where else to look...
I am working on a VB.NET program to catalog my video collection. I have designed a class called VideoTitle. One of the methods I believe this class should implement is an Add Video method. When a video gets added, it will need to look at my DB to get the next ID number that it will be assigned.
Here's the question... In best practices, would the code within the class itself do the read from the DB to get the next ID, or would that be done outside the class, in the form's code that instantiates the VideoTItle object?
My thinking is that I should use a constructor that takes parameters including the ID, so I'm thinking the DB read/writes should be kept out of the class code, is this the best way?
Thanks in advance...
I am working on a VB.NET program to catalog my video collection. I have designed a class called VideoTitle. One of the methods I believe this class should implement is an Add Video method. When a video gets added, it will need to look at my DB to get the next ID number that it will be assigned.
Here's the question... In best practices, would the code within the class itself do the read from the DB to get the next ID, or would that be done outside the class, in the form's code that instantiates the VideoTItle object?
My thinking is that I should use a constructor that takes parameters including the ID, so I'm thinking the DB read/writes should be kept out of the class code, is this the best way?
Thanks in advance...