Use of a strongly Typed Dataset:
1 project --> new item --> data --> dataset --> *. XSD file --> drag and drop the database file Dataset Designer window in the server resource manager. The system will automatically generate the fill and getdata () methods, that is, the Select * from table name in the database query.
2. You can also customize SQL queries: in the Dataset Designer window, right-click --> Add --> query --> use SQL statements --> what type of SQL is used (select as needed --> Fill in SQL statements --> Fill in datatale: fill () and returned datatable: getdata () method --> generation method)
3. Do not forget to create a primary key for the data table, and try not to have a null value. If it may be null, use the is *** null () method for determination.
4. to modify the table structure, right-click the form generated in the XSD View --> Configure --> complete,
5. To add or delete a table structure, right-click the form generated in the Dataset Designer and choose "Configure"> "Query Builder". Select the newly added or deleted structure.
6. Then you can directly call it in the program.
7. Remember that dataset extracts data from the database and stores the data in the local memory. Then, when you modify the data locally, if you do not re-read the database to obtain the data, you cannot obtain the updated data in time. The two are asynchronous.
8. You can open the database before the database is closed for batch operations that require repeated calls. In dataset, the connection is enabled and closed as follows: if the connection is not open, it will open. If the connection is close, it will close (it is hard to understand that it is written in this way. You can check the dataset table name in the XSD file. designer. CS ). In this way, the connection is opened first during batch operations, so that the connection will not be opened again after each operation, and then the connection will not be closed if you do not close it. The dataset is closed until the batch operation is completed. This ensures that all operations can greatly optimize the database access speed in one connection.