« Home « Chủ đề kĩ thuật lập trình

Chủ đề : kĩ thuật lập trình


Có 160+ tài liệu thuộc chủ đề "kĩ thuật lập trình"

Introducing Transactions

tailieu.vn

I'll show you how to use an object of the SqlTransaction class in this section.. The first INSERT statement will add a row to the Customers table, and the second one will add a row to the Orders table. Create a SqlTransaction object and start the transaction by calling the BeginTransaction() method of the SqlConnection object.. Create a SqlCommand object...

Introducing Triggers

tailieu.vn

A database trigger is a special kind of stored procedure that is run automatically by the database-or in trigger terms, fired-after a specified INSERT, UPDATE, or DELETE statement is run against a specified database table. For example, instead of performing an INSERT to add a row to the Products table, a trigger could raise an error if a product with...

Introducing Visual Studio .NET

tailieu.vn

Introducing Visual Studio .NET. You can use Visual Studio .NET (VS .NET) to create console applications, as well as the following types of applications:. Windows Applications These take advantage of the visual controls offered by the Windows operating system, such as menus, buttons, and editable text boxes.. You'll learn about Windows programming in Chapter 6,. "Introducing Windows Applications and ADO.NET."....

Issues Involved When Updating the Primary Key of a Parent Row

tailieu.vn

Issues Involved When Updating the Primary Key of a Parent Row. In this section, you'll learn about the issues involved when attempting to update the primary key in a parent DataTable, and then pushing the update to the underlying. The issues occur when the child database table already contains rows that use the primary key you want to change in...

Maintaining State in a Web Application

tailieu.vn

Storing information on the server gives you more control of the stored information, but since this consumes server resources, you need to be careful not to store too much. Storing Information on the Client. To store information on the client, you can use cookies or the Page object's ViewState property. A cookie is a name and value pair that is...

Modifying Data Using a Strongly Typed DataSet

tailieu.vn

NewCustomersRow() method of myDataTable MyDataSet.CustomersRow myDataRow = myDataTable.NewCustomersRow();. myDataTable.AddCustomersRow(myDataRow);. myDataRow = myDataTable.FindByCustomerID("J5COM");. foreach (MyDataSet.CustomersRow myDataRow2 in myDataTable.Rows). myDataTable.RemoveCustomersRow(myDataRow);

Modifying Rows in a DataTable phần 1

tailieu.vn

In this section, you'll see the steps required to add, modify, and remove DataRow objects from a DataTable and then push those changes to the database. The examples in this section show how to add, modify, and delete rows in the Customers database table.. Note You'll find a complete program named AddModifyAndRemoveDataRows.cs in the ch11 directory that illustrates the use...

Modifying Rows in a DataTable phần 2

tailieu.vn

step 3: use the Add() method through the Rows property. to add the new DataRow to the DataTable. Console.WriteLine("Calling myDataTable.Rows.Add()");. myDataTable.Rows.Add(myNewDataRow);. Console.WriteLine("myNewDataRow.RowState = ". myNewDataRow.RowState);. step 4: use the Update() method to push the new. row to the database. Console.WriteLine("Calling mySqlDataAdapter.Update()");. int numOfRows = mySqlDataAdapter.Update(myDataTable);. Console.WriteLine("numOfRows = ". You don't have to do this because the Update() method-like the Fill()...

Nested XML

tailieu.vn

Notice that this program writes two XML files named nonNestedXmlFile.xml and nestedXmlFile.xml. The nonNestedXmlFile.xml contains the default non-nested rows, and nestedXmlFile.xml contains the nested rows after the. of a DataRelation to true causes the the child rows to be nested within the parent rows in the output XML. Console.WriteLine("Writing XML out to file nonNestedXmlFile.xml");. myDataSet.WriteXml("nonNestedXmlFile.xml");. (causes child rows to be...

Obtaining the Required Software

tailieu.vn

Before you can develop C# programs, you'll need to install either the .NET Software Development Kit (SDK) or VS .NET. You can download the .NET SDK at. http://msdn.microsoft.com/downloads (search for the Microsoft .NET Framework Software Development Kit). You can purchase a trial or full copy of VS .NET from Microsoft at http://msdn.microsoft.com/vstudio.. To install the .NET SDK, run the executable...

Performing a SQL SELECT Statement and Storing the Rows Locally phần 1

tailieu.vn

Performing a SQL SELECT Statement and Storing the Rows Locally. In the example featured in this section, you'll see how to connect to the SQL Server Northwind database and perform a SQL SELECT statement to retrieve the CustomerID, CompanyName, ContactName, and Address columns for the first 10 rows from the Customers table. These rows are stored in a DataSet object.....

Performing a SQL SELECT Statement and Storing the Rows Locally phần 2

tailieu.vn

The Fill() method then creates a DataTable in the DataSet with the specified name and runs the SELECT statement. The DataTable created in your DataSet is then populated with the rows retrieved by the SELECT statement.. to the Fill() method:. You can access these rows, even when disconnected from the database.. Step 11: Close the Database Connection. Close the database...

Performing Advanced Filtering

tailieu.vn

You can therefore use very powerful filter expressions in your DataView. For example, you can use AND, OR, NOT, IN, LIKE, comparison operators, arithmetic operators, wildcard characters. Note For full details on how to use such filter expressions in your DataView objects, refer to the DataColumn .Expression property in the .NET online documentation.. When this code replaces the existing code...

Reading a Column Value Using Strongly Typed DataSet Classes

tailieu.vn

Reading a Column Value Using Strongly Typed DataSet Classes. A strongly typed DataSet object allows you read a column value using a property with the same name as the column. For example, to read the CustomerID of a column, you can use myDataRow.CustomerID rather than myDataRow["CustomerID". Another feature of a strongly typed DataSet is that when you work with it...

Reading Null Values

tailieu.vn

As you learned in Chapter 2, a column defined as null can store a null value. A null value indicates that the column value is unknown. Let's consider an example of reading a null value from the database. performed a SELECT statement that retrieves the UnitPrice column for a row from the Products table, and that the UnitPrice column contains...

Reading Rows from a SqlDataReader Object

tailieu.vn

You can read an individual column value in a row from a DataReader by passing the name of the column in square brackets. You can also specify the column you want to get by passing a numeric value in brackets. The first code snippet uses the column names to read the column values:. while (productsSqlDataReader.Read. Console.WriteLine(productsSqlDataReader["ProductID"]);. Console.WriteLine(productsSqlDataReader["ProductName"]);. Console.WriteLine(productsSqlDataReader["UnitPrice"]);. Console.WriteLine(productsSqlDataReader["Discontinued"]);. The...

Retrieving New Identity Column Values

tailieu.vn

The ProductID column of the Products table is an identity column. In this section, you'll see how to insert a new row into to Products table and retrieve the new value generated by the database for the ProductID identity column.. Note You'll find a complete program named UsingIdentityColumn.cs in the ch11. In the examples, assume you have a DataTable named...

Returning Strongly Typed Column Values

tailieu.vn

Up to this point, you've retrieved column values from a DataReader only as generic objects of the System.Object class (such objects are often referred to as being of the C#. Note All classes in C# are derived from the System.Object class.. I'll rewrite the while loop shown in the example in the previous section to show how you store column...

Setting a Savepoint

tailieu.vn

This might be useful if you have a very long transaction because if you make a mistake after you've set a savepoint, you don't have to roll back the transaction all the way to the start.. Inserts a row into the Customers table with a CustomerID of J8COM.. Sets a savepoint.. Inserts a row into the Orders table with a...

Setting the Transaction Isolation Level

tailieu.vn

Setting the Transaction Isolation Level. The transaction isolation level is the degree to which the changes made by one. Before I get into the details of the various transaction isolation levels, you need to understand the types of problems that might occur when current transactions attempt to access the same rows in a table. Dirty reads Transaction 1 updates a...