日期:2012-03-21  浏览次数:20468 次

ADO.NET 1: Namespaces and Classes
Microsoft has changed many things in its recent .NET Beta 2 release. Most of the code compiled in Beta 1 may not compile in Beta 2. So if you are working on Beta 1, you might want to upgrade it to Beta 2. .NET Beta 2 SDK and VS.NET Beta 2 is available for download on Microsoft's MSDN site for MSDN subscribers.
ADO.NET Namespaces
In my first article, I'll discuss some of the ADO.NET changes. If you remember Beta 1, there were two common namespaces - System.Data.ADO and System.Data.SQL.  Beta 1Beta 2DescriptionSystem.Data.ADOSystem.Data.OleDbThis namespace contains database classes to work with OLE DB data sources.System.Data.SQLSystem.Data.SqlClientClasses to work with SQL Server 7.0 or later databases.
ADO.NET Data Components
Besides the namespaces name changes, there are other changes such as Data Components. Most of the data components remain same besides DataSetCommand. In Beta 2, DataSetCommand component is replaced with DataAdapters. DataAdapters sits between a DataSet and a Database and fills data from the data source to the DataSet. Our following articles and sample code will show you how to work with DataAdapters.Beta 1Beta 2DescriptionADODataSetCommandOleDbDataAdapterThe FillDataSet method used to fill a DataSet object from the ADODataSetCommand, which is replaced with Fill method of OleDbDataAdapter.SQLDataSetCommandSqlDataAdapterThe FillDataSet method used to fill a DataSet object from the SQLDataSetCommand, which is replaced with Fill method of SqlDbDataAdapter.
See my tutorial on DataAdapters Tutorial: Working with OleDb Data Adapters for how to write database applications using DataAdapters.
DataSet and DataView components remain same in Beta 2. So that's all good since most of the programming revolves around DataSet.
One more component changed in Beta 2 is DataSetView. DataSetView is called DataViewManager. I didn't look into the details of DataViewManager but I'ld think no changes in that class.
Connection and DataAdapters
There is one big change in Beta 2 is working with DataConnection and DataAdapters. If you create DataAdapter application,  (See Tutorial: Working with OleDb Data Adapters), there is no direct connection between Data Adapters and Connection objects. In Beta 1, you could connect a DataSetCommand direct to a Connection object.
In Beta 2, you use DataCommands to connect a Connection object with the Data Adapters. There are four command objects for each INSERT, DELETE, UPDATE, and SELECT SQL queries.
There are more changes but I think its enough for today. Its late and I better go get some sleep otherwise I won't be able to work tomorrow ;). May be, Mike or I'll write more articles in more depth some other day. There are many other areas to be discussed. Tomorrow, I 'll try to cover few XML.NET areas. If you think you found something, which is different in Beta 2 than Beta1, just drop me a mail at mcb@mindcracker.com and help your fellow developers.
Happy .Neting ;).