I wanted to ask is there a universal api to connect to any or to many databases from MySQL, MS SQL to Oracle, etc without having to change the sqlConnection, sqlCommand, etc for every different database?
I am asking this question because my application will hjave an option to connect to MS SQL, MySQL or Oracle.
The problem with it is that it's not optimized to connect to any one database type, and hence, performance suffers a bit.
The way it's normally done is you create a database provider layer for your application supporting the connection to the database type that's chosen. This is where a tiered application design approach comes in.
Second problem: Your checkboxes don't have any values, and the Repeater control doesn't support the DataKey properties which would allow you to store arbitrary values against each item.
If you just want to return the value of the ResText field, it's fairly simple: bind the Text property of the CheckBox control to the ResText field, and return that. (This will also improve accessibility, since it will render a <label> for each CheckBox.)
Both allow you to stub out or define aspects of a class that you may know but not completely or you may not be the one ultimately filling in the functionality.
Interfaces allow you to specify what properties, methods, and events MUST be present on an object that conforms to that interface. Take, for example, INotityPropertyChanged. If an object implements that interface, then it MUST expose a PropertyChanged event with a specific signature. When another object wants to be notified that a property changed, it can inspect the target class to see if that interface is implemented and if so, hook the event. Because now you know what the event name and signature must be.
Interfaces, however, only specify the properties, events, and methods that a class must expose and a class may implement more than one interface. Abstract classes, however, have a bit more meat on their bones. They are actual classes but simply stub the method functionality leaving it to be implemented in a class that inherits from the abstract class. A good example might be a data access object that exposes some data stored in the database. You would define an interface for the class including the methods needed to get and save data. You might then create an abstract class that provides some basics but doesn't include any details on how to get to the database. Finally, you might create two or three concrete classes from the abstract class that each know how to connect to a specific database server... maybe one for SQL, another for Oracle, and a 3rd for NoSQL. At runtime you can use reflection to find the proper concrete class and load it. Your code works with only the interfaces but at runtime is provided with the concrete instance of the appropriate class.
Last Visit: 31-Dec-99 18:00 Last Update: 9-Mar-14 6:46