« Home « Chủ đề ASP.NET Web developer's Guide

Chủ đề : ASP.NET Web developer's Guide


Có 40+ tài liệu thuộc chủ đề "ASP.NET Web developer's Guide"

Microsoft ADO .NET 4 Step by Step - p 20

tailieu.vn

166 Microsoft ADO .NET 4 Step by Step. This code accesses the records in the second set of results, the SELECT statement for the OrderEntry table, via the NextResult method call.. This chapter discussed parameters, which are data value objects that help ensure the accuracy and safety of the data being sent to and returned from external data sources. Each...

Microsoft ADO .NET 4 Step by Step - p 21

tailieu.vn

Build the selection query.. "SELECT * FROM UnitOfMeasure", linkToDB);. unitAdapter.SelectCommand = unitCommand;. Build the insertion query.. SET @ID = @@IDENTITY;", linkToDB);. unitCommand.Parameters.Add("@ShortName", SqlDbType.VarChar, 15, "ShortName");. unitCommand.Parameters.Add("@FullName", SqlDbType.VarChar, 50, "FullName");. unitCommand.Parameters.Add("@ID", SqlDbType.BigInt, 0, "ID");. unitAdapter.InsertCommand = unitCommand;. Build the revision query.. @"UPDATE UnitOfMeasure SET ShortName = @ShortName, FullName = @FullName WHERE ID = @ID", linkToDB);. param = unitCommand.Parameters.Add("@ID", SqlDbType.BigInt, 0, "ID");....

Microsoft ADO .NET 4 Step by Step - p 22

tailieu.vn

Sometimes it isn’t convenient or even possible to use the same table and column names between your local DataTable and the external database table, view, or generated results it represents. Remember that when SqlDataAdapter retrieves result sets from the database, it names the first set “Table,” the second set “Table1,” and so on. For example, suppose you use the DataSet...

Microsoft ADO .NET 4 Step by Step - p 23

tailieu.vn

linkToDB.Open();. SqlTransaction envelope = linkToDB.BeginTransaction();. After obtaining a transaction object, add it to any SqlCommand objects that should be part of the transaction.. Include the transaction in the SqlCommand constructor.. SqlCommand updateCommand = new SqlCommand(sqlText, linkToDB, envelope);. SqlCommand updateCommand = new SqlCommand(sqlText, linkToDB);. Dim updateCommand As New SqlCommand(sqlText, linkToDB, envelope). Dim updateCommand As New SqlCommand(sqlText, linkToDB) updateCommand.Transaction = envelope. After...

Microsoft ADO .NET 4 Step by Step - p 24

tailieu.vn

The body of the routine hosts two nested using blocks.. Commit the transaction” comment, add the following line:. In the local-transaction sample earlier in this chapter, attempting to overdraw funds caused the transaction to fail in the first half of the two-part update:. You can force a failure in the second half of the transaction by selecting a transfer in...

Microsoft ADO .NET 4 Step by Step - p 25

tailieu.vn

On the model side of the Framework, an association set contains the field definitions that describe a single association between two tables.. An entity can also contain foreign keys to an associated entity, but these keys provide less direct access to related data.. Entity set An entity set is the logical container for an entity and any other entities de-...

Microsoft ADO .NET 4 Step by Step - p 26

tailieu.vn

Similar to the Data Source Configuration Wizard demonstrated in Chapter 1, “Introducing ADO.NET 4,” the Entity Data Model Wizard guides you through the database selection and connection process, which serves four main purposes:. To build the connection string for both the model and the target database. To build an application-side storage layer that parallels the database-side tables, views, and stored...

Microsoft ADO .NET 4 Step by Step - p 27

tailieu.vn

If not already available in your Visual Studio Integrated Development Environment (IDE), access the Mapping Details panel by right-clicking the model’s visual design surface and selecting Mapping Details from the shortcut menu.. To use the Mapping Details panel, select an entity from the visual design surface. The panel displays all column mappings already defined for the entity, with storage model...

Microsoft ADO .NET 4 Step by Step - p 28

tailieu.vn

Getting to Know Entity SQL. Entity SQL is based in part on the T-SQL imperative query language found in Microsoft’s SQL Server product. Despite this lineage, there are some significant differences between T-SQL and Entity SQL:. Entity SQL is a selection-only language. Whereas T-SQL includes support for data manipulation language (DML) and data definition language (DDL), Entity SQL supports only...

Microsoft ADO .NET 4 Step by Step - p 29

tailieu.vn

Running Entity SQL Queries. The Entity Framework includes two key ways of using Entity SQL queries to access entity- managed data: using an ObjectQuery instance to query the entities within the context directly or using a more traditional ADO.NET provider-like interface.. The System.Data.Objects.ObjectQuery(Of T) class-processes an Entity SQL statement against an open EF context and returns the results as a...

Microsoft ADO .NET 4 Step by Step - p 30

tailieu.vn

Understanding Entities Through Objects. One of the main advantages of the Entity Framework (EF) is that you can manage database content using standard .NET objects that reflect the conceptual nature of the data. Imagine being able to modify the Name property of a Customer object in code and have that change propagate to the database—. all without having to write...

Microsoft ADO .NET 4 Step by Step - p 31

tailieu.vn

Open the “Chapter 16 VB” project from the installed samples folder. The project in- cludes Windows.Forms classes named CustomerEditor and CustomerDetail, which let a user modify records in the sample database’s Customer table.. this is a routine that uses a SqlConnectionStringBuilder to create a valid con- nection string to the sample database. Just after the “Update the individual fields” comment,...

Microsoft ADO .NET 4 Step by Step - p 32

tailieu.vn

Microsoft ADO .NET 4 Step by Step. Chapter 18: Using LINQ to DataSet Chapter 19: Using LINQ to Entities Chapter 20: Using LINQ to SQL. Understand the purpose of LINQ in your applications. Craft typical LINQ queries using ordinary .NET objects. Given its consistency in the programming industry, it comes as no surprise that Microsoft would endow both Visual Basic...

Microsoft ADO .NET 4 Step by Step - p 33

tailieu.vn

var results = transport.Where(tr =>. tr.SpeedClass. Dim results = transport.Where(Function(tr) tr.SpeedClass = 1). var results = from tr in transport. where tr.SpeedClass. tr.Name.EndsWith("cycle") select tr;. Dim results = From tr In transport. Where tr.SpeedClass = 1 And tr.Name Like "*cycle". Select tr. orderby tr.SpeedClass descending, tr.Name select tr;. Order By tr.SpeedClass Descending, tr.Name Select tr. This sorts by tr.Name (ascending)...

Microsoft ADO .NET 4 Step by Step - p 34

tailieu.vn

LINQ to DataSet also lets you craft queries that use ADO.NET Typed Data Sets. however, the Entity Framework supercedes most of the advantages of typed data sets. Therefore, LINQ queries against typed data sets are not discussed in this book.. Writing Queries with LINQ to DataSet. With the exception of the new enumerated methods specific to LINQ to DataSet, using...

Microsoft ADO .NET 4 Step by Step - p 35

tailieu.vn

When you write an EF query, the Framework prepares a T-SQL query (when SQL Server is used as the backend database) that it runs on the database server to obtain the desired records. That database action occurs only when you access the results of the query statement.. For this reason, all LINQ to Entities queries can involve only objects and...

Microsoft ADO .NET 4 Step by Step - p 36

tailieu.vn

The code for both appears in the discussion immediately before this example.. in the database.. Instead, the EdmFunction attribute notifies LINQ that it should locate the AdmittedInYear function exposed in the SalesOrderModel.Store namespace of the model and call that function instead. This query includes a call to both a native database function (SqlFunctions.DatePart) and the custom function (AdmittedInYear) that matches...

Microsoft ADO .NET 4 Step by Step - p 37

tailieu.vn

The Designer adds a .dbml file to your project, which hosts the data model in XML form. The Designer produces the designer file content as you make content- related changes to the visual design.. You build your data model by dragging classes (entities) and associations (relationships) to the left pane of the designer surface. You can also include database-level stored...

Microsoft ADO .NET 4 Step by Step - p 38

tailieu.vn

Binding Data with ADO .NET. Bind data to controls in Windows Forms, WPF, and ASP.NET applications. Data binding involves connecting display and data-entry controls with a data source in a way that somewhat automates the data management process. This simulated simplicity—the true complexity is hidden away inside of .NET controls and classes—brings Rapid Application Development (RAD) features from pre-.NET versions...

Microsoft ADO .NET 4 Step by Step - p 39

tailieu.vn

Building the WPF project is simple using drag-and-drop techniques, but as the example proj- ect demonstrates, it’s possible to view only the initial record in the incoming table. Adding Navigation to a Data-Bound WPF Window: C#. Add four Button controls from the Toolbox panel to the WPF window surface. Move to the first record in the table.. System.Windows.Data.CollectionViewSource catalogSource =...