Skip to main content
8 events
when toggle format what by license comment
Nov 22, 2015 at 10:08 vote accept Krowi
Apr 19, 2015 at 20:33 comment added Mord Zuber Very nicely written. It helped solidify some concepts for me.
Apr 19, 2015 at 9:06 comment added s.m. @Krowi I edited the answer.
Apr 19, 2015 at 9:06 history edited s.m. CC BY-SA 3.0
Answer OP's comment.
Apr 19, 2015 at 5:21 comment added craftworkgames Classes that need to interact with the database typically get a reference to the database class in their own constructors.
Apr 18, 2015 at 23:55 comment added Krowi Well, the reason why I made it static is because the class has to be used in several classes. I have for ex. classes like Item, Person, Factory, ... which all have an interaction to the database. Each class has an Insert, Update, ... method. In my POV it looks easier to set the connection once e.g. while starting the application and then be able to use the class everywhere without having to initialize it every time. From what you say I understand that I should initialize the class each time and pass the connection string before calling the method. If not, what approach would you suggest?
Apr 18, 2015 at 19:42 history edited s.m. CC BY-SA 3.0
Talk about exceptions
Apr 18, 2015 at 19:31 history answered s.m. CC BY-SA 3.0