TAILIEUCHUNG - Use Visual Studio .NET Tools to Speed Up Writing ADO.NET

Sử dụng Visual Studio NET Công cụ. Để tăng tốc độ Viết Mã Mã bạn đã viết đến thời điểm này không làm điều đó nhiều. Nó thậm chí không truy cập vào cơ sở dữ liệu. Nhiệm vụ tiếp theo là viết code mà populates lớp với dữ liệu từ cơ sở dữ liệu, | Use Visual Studio .NET Tools to Speed Up Writing Code The code you ve written up to this point doesn t do that much. It doesn t even access the database. The next task is to write code that populates the class with data from the database and the first step in doing this is setting up database access objects. Technique In Chapter 3 you learned how to fill a dataset to store data in a disconnected fashion. In this chapter you will use a strongly typed dataset-that is a dataset with data rows that match the name and datatypes of the columns. You will learn how to use the DataAdapter Configuration Wizard to autogenerate code that initializes Command and DataAdapter objects for use with a specific table. Steps 1. Right-click on your project and select Add New Item from the Add menu. Choose DataSet and name it . 2. Visual Studio .NET opens in Design mode. Expand the Server explorer and drill down to Data Connections Northwind Tables. Drag the Customers table onto the Design view. 3. Visual Studio might process for a few seconds but afterward you ll have a strongly typed dataset. The result Instead of writing dataset code like this strCustomerID CType Customers .Rows O .Item CustomerID String you ll have code that looks like this strCustomerID 0 .CustomerID A strongly typed dataset is a combination of two documents. One is a .vb file with the same name as the dataset. Visual Studio .NET will not show you the contents of this file unless you step into it while debugging and the contents don t appear in the Solution Explorer. The other file is an .xsd file or a XML Schema Definition XSD which defines a data structure. The .vb file reads the XSD to properly instantiate a strongly typed dataset. You should always take a look at any code that is generated automatically by a tool because the tool might generate code that doesn t do precisely what you want it to do. If you have never seen an XSD this is also a .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.