Dataset has a collection of Tables which has the DataTable collection which further has DataRow & DataColumn objects collections.
Dataset also has collections for the primary keys, constraints, and default values called as constraint collection.
There is also a default view object for each table. This used to create a Data View object based on the table so that the data can be searched, filtered or otherwise manipulated while displaying the records.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
using System.Data.SqlClient; try { // Opening connection string Connection = "server=localhost; uid=techstudy-pc; password=myPass; database = SampleDB"; SqlConnection con = new SqlConnection(Connection); conn.Open(); } catch ( Exception ex ) { // Log Exceptions } finally { con.Close ( ) ; // Close the connection } |
Dataview is used for sorting & filtering data in a datatable.
1 2 3 |
//Example DataTable Student = GetTable(); Student.DefaultView.Sort = "FirstName"; |
Pessimistic locking is used when the user wants to update a record in a database & the user want to prevent other users from updating the same record at the Same time another user can only view the data when there is pessimistic locking.
Optimistic locking is used to improve concurrent operations on a record by allowing many users to update the same record. The record is only locked when updating the record. Optimistic locking has been widely used by programmers.
Connection pooling in ADO.NET is used to reduce the overhead of creating a connection to the database. A connection pool will have a predefined number of minimum and maximum connections to the database which will be used by the application to execute queries. Once application completes a transaction, the connection will be released and the connection will go back to connection pool rather than connection getting closed.
Max Pool Size – Maximum size of connection pool
Min Pool Size – Minimum no of connections that will be created in connection pool at application start up.
Pooling – To set connection pooling to on or off.
Connection Timeout – Wait period for a new connection.
Default max pool size in ADO.NET is 100.
To enable connection pooling "Use Pooling = true" in connection pooling
To disable connection pooling set Pooling = false in connection pooling
DataSet.Clone copies only the structure of the DataSet. In other words, the Clone method of the DataSet class copies only the schema of a DataSet object.
Dataset.CopyDataSet.Copy copies both the structure (tables, relations etc) and the data.In other words, the Copy method of the DataSet class copies both the structure and data of a DataSet object.
Database Access Layer
Business Logic Layer
Presentation Layer
11 January 2019 2562 Written By: Rohit
© 2020 Tech Study. All rights reserved | Developed by Tech Study| Privacy Policy | Sitemap