[ Pobierz całość w formacie PDF ]
.Most developers have found that they need to continue using ADO for LAN development or in scenarios where an application requires good two-waycommunication.The reason ADO.NET is such a good addition for the distributed computingenvironment is that it relies on disconnected datasets and client side cursors tworequirements for applications used on the road.Using loosely coupled access also reducesthe resource load on a server, making more resources available for all users.One of the secrets of ADO.NET is the use of eXtensible Markup Language (XML) as thedata transfer media.The use of plain ASCII text by XML enables the data to pass throughfirewalls unhindered.Binary data transfers often encounter problems with firewalls becausethe use of binary data hinders the efforts of virus checkers.Firewalls also close data portsthat older data transfer methods require.The problem with ports is that administratorsnormally keep as many ports closed as possible to help reduce the chance of crackerintrusions.XML uses port 80, the same port commonly used for HTML data transfers.Binarydata transfer problems became one of the reasons that developers asked for somethingbetter than the Distributed Component Object Model (DCOM) and also the reason they needsomething better than ADO or OLE-DB for database management.Before you can access any data, you need a provider that works with the DatabaseManagement System (DBMS) in question.ADO.NET fully supports all of the providers thatADO supports.In addition, you gain access to the providers in the.NET Framework.However, don t get the idea that having two sources for providers increases youropportunities to connect to other servers.Most of the drivers provided with the.NETFramework at the time of this writing are for big name DBMS, such as Oracle, or Microsoft sown products, such as SQL Server.In fact, you ll find that the two main namespaces areSystem.Data.SqlClient and System.Data.OleDB.You must have SQL Server 7.0 or later touse the System.Data.SqlClient namespace.Note that the OLE-DB driver for ODBC(MSDASQL) doesn t work you must download the separate ODBC.NET providerdiscussed in the next section.As with the other data access technologies discussed so far, you use objects to work withdata under ADO.NET.It s important to remember the purpose of ADO.NET as you lookthrough the list of objects.These objects focus on the needs of distributed applicationsyou ll still use ADO or OLE-DB for LAN or WAN applications.The following list describes thefour objects and tells how you use them.Connection Every data communication requires a connection to a data source.ADBMS manages the data source, and you must establish communication with theDBMS before you can access the data.The connection process includes setting asideresources for the data exchange and security issues such as user verification.Command The act of accessing data or making some other request of the DBMS afteryou establish contact with it is a command.Many developers know something aboutstructured query language (SQL) commands, because SQL is the default standard formost DBMS communications.When you work with ADO.NET, you can either processthe results of a command directly or place the results in a DataReader.DataReader The DataReader is a special type of object that provides read-onlyaccess to the results of a command.You can read the data in a forward-only direction,and your application must rely on client side cursors.The purpose of the DataReader isto provide client side access to data in a disconnected scenario.In short, the clientdoesn t require access to the server to access the information.DataAdapter You ll use the DataAdapter to populate a dataset.It also updates thedata source as users make changes to the dataset.The DataAdapter enables you toupdate information on the remote server, but requires special handling and a liveconnection to the server.You d use this object to upload new information a user createswhile working in disconnected mode. ODBC.NET: Microsoft Breathes Life into anExisting TechnologyODBC is the technology that Microsoft was originally going to leave out of Visual Studio.NET.After all, the reasoning was that everyone should have moved onto something newerand better.However, not everyone has moved to OLE-DB or ADO, not to mention their.NETcounterparts.After profuse screaming on the part of a multitude of beta testers, Microsoftfinally relented and provided us with ODBC.NET.NoteThe only problem is that you won t see ODBC.NET in the Visual Studio.NET package.Because ODBC.NET got a late start, you won t actually seeit for a few months after the release of Visual Studio.NET.However, youcan find it athttp://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/668/msdncompositedoc.xml.You can also learn about thelatest ODBC.NET developments on themicrosoft.public.dotnet.framework.odbcnet newsgroup.After you install the ODBC.NET provider, you ll find a new namespace on your system:System.Data.Odbc.The new namespace uses the same four objects as ADO.NET, so youhave access to a Connection, Command, DataReader, and DataAdapter object.Workingwith the namespace is similar to working with the two ADO.NET namespaces.However, youhave the same options that you would with any ODBC implementation.For example, youcan use Data Source Names (DSNs) to create a connection to a data source.Windows supports three basic types of DSNs: User, System, and File.The User and SystemDSN are essentially the same.However, the User DSN affects only the current user, whilethe System DSN affects everyone who logs onto the current machine.The File DSN is a textrepresentation of a DSN.You can open a File DSN in a program like Notepad and see howit s put together.The following sections show you how to create the three DSN types and logthe ODBC activities on your system.CautionYou ll normally need to create an entry on the User DSN tab for single-user databases and on the System DSN tab for machine databases.Under no circumstances create an entry on both the User DSN andSystem DSN tabs that uses the same name [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • andsol.htw.pl