If you want a simple program that can display and modify data, then the solution described in the previous sections may be good enough. In that case, you can let Visual Basic do most of the work for you, and you don’t need to dig into the lower-level details of database access.
You can also use objects similar to those created by Visual Basic to build your own solutions. You can create your own DataSet, TableAdapter, BindingSource, and BindingNavigator objects to bind controls to a database. (You can even modify the controls supplied by Visual Basic by overriding their properties and methods, although that’s a very advanced topic so it isn’t covered here.)
If you need to manipulate the database directly with code, it doesn’t necessarily make sense to create all these objects. If you simply want to modify a record programmatically, it certainly doesn’t make sense to create DataGridView, BindingNavigator, and BindingSource objects.
For cases such as this, Visual Basic provides several other kinds of objects that you can use to interact with databases. These objects fall into the following four categories:
Data container and adapter classes are generic and work with different kinds of databases, but different types of connection and command objects are specific to different kinds of databases. For example, the connection objects OleDbConnection, SqlConnection, OdbcConnection, and OracleConnection work with Object Linking and Embedding Database (OLE DB); SQL Server, including SQL Server Express; Open Database Connectivity (ODBC); and Oracle databases, respectively. The SQL Server and Oracle objects work only with their specific brand of database, but they are more completely optimized for those databases and may give better performance.
Aside from the different database types they support, the various objects work in more or less the same way. The following sections explain how an application uses those objects to move data to and from the database. They describe the most useful properties, methods, and events provided by the connection, transaction, data adapter, and command objects.
Later sections describe the DataSet and DataView objects and tell how you can use them to bind controls to display data automatically.
3.142.133.180