tailieunhanh - Reading a Column Value Using Strongly Typed DataSet Classes

Reading a Column Value Using Strongly Typed DataSet Classes A strongly typed DataSet object allows you read a column value using a property with the same name as the column. | Reading a Column Value Using Strongly Typed DataSet Classes A strongly typed DataSet object allows you read a column value using a property with the same name as the column. For example to read the CustomerID of a column you can use rather than myDataRow CustomerID . This is a nice feature because the compiler can then catch any errors in column spellings at compile time rather than runtime. For example if you incorrectly spelled CustomerID as CustimerID then the mistake would be caught by the compiler. Another feature of a strongly typed DataSet is that when you work with it in VS .NET IntelliSense automatically pops up the properties and methods of the DataSet when you are typing. You can then pick the property or method from the list rather than have to type it all in. The downside to using a strongly typed DataSet is that you must do some initial work to generate it before you can use it. If the columns in your database tables don t change very often then you should consider using strongly typed DataSet objects. On the other hand if your database tables change a lot you should probably avoid them because you ll need to regenerate the strongly typed DataSet to keep it synchronized with the definition of the database table. Note You ll find a completed VS .NET example project for this section in the StronglyTypedDataSet directory. You can open this project in VS .NET by selecting File Open Project and opening the file. You ll need to change the ConnectionString property of the sqlConnection1 object to connect to your SQL Server Northwind database. You can also follow along with the instructions in this section by copying the DataReader directory to another directory and using that project as your starting point. Creating a Strongly Typed DataSet Class In this section you ll create a strongly typed DataSet class that is used to access the Customers table. If you re following along with these instructions open the .

TÀI LIỆU LIÊN QUAN
10    158    1
6    184    1
7    162    1
5    157    1
6    160    1
6    152    1
6    150    1
6    206    1
7    154    1
5    121    1