In.. net. data. in the SqlClient namespace, I believe many people use this method for programming, and Microsoft. applicationBlocks. data. in the SqlHelper namespace, the methods are roughly the same. Why are two different spaces providing similar functions?
Microsoft is launching. by default, the System and Microsoft namespaces are attached to the. net System. Microsoft namespaces are powerful supplements to the System namespaces. data. to program SqlClient, you need to use SqlCommand and SqlDataAdapter. You need to manage the database to open and close, for example
Cn. open (); // open the database connection
SqlDataReader dr = cmd. ExecuteReader (CommandBehavior. CloseConnection); // close the connection when the dataset is closed.
Dr. Close (); // Close the dataset (the database connection is also disabled)
However, in the Microsoft. ApplicationBlocks. Data. SqlHelper namespace, the same operation is not required.
SqlDataReader dr = SqlHelper. ExecuteReader (cn, CommandType. Text, querySql );
Two-phase comparison, the following is more satisfactory, isn't it?
Since programming in Microsoft's system, the best choice of course is to maximize the use of what Microsoft provides ,.. net System. similar to a secondary development product that provides the basic functions of net, its further optimized functions are naturally not limited to database development. It also takes more time to study these functions, this product is still open-source. If you are interested, you can download it on msdn. Now it is in version 2.0.
I hope those who have profound insights will teach me this.