« Home « Chủ đề sybex - c.sharp database programming

Chủ đề : sybex - c.sharp database programming


Có 60+ tài liệu thuộc chủ đề "sybex - c.sharp database programming"

Exploring the DataAdapter and DataTable Events

tailieu.vn

You'll find all the code examples shown in this section in the program UsingEvents.cs located in the ch11 directory. The events exposed by a SqlDataAdapter object are shown in Table 11.11.. Table 11.11: SqlDataAdapter EVENTS EVENT EVENT HANDLER DESCRIPTION. FillError FillErrorEventHandler Fires when an error occurs during a call to the Fill() method.. RowUpdating RowUpdatingEventHandler Fires before a row is...

Exploring the Northwind Database

tailieu.vn

Figure 2.11 is a repeat of the diagram shown earlier that illustrates how these tables are related.. Figure 2.11: Relationships between the Customers, Orders, Order Details, and Products tables. For example, the Customers table contains 11 columns:. In the next few sections, you'll learn some database theory, and then you'll learn how each of the previous columns is defined in...

Finding DataRowView Objects in a DataView

tailieu.vn

Finding DataRowView Objects in a DataView. You can find the index of a DataRowView in a DataView using the Find() method of a DataView. You can also get an array of DataRowView objects using the FindRows() method of a DataView. You'll learn how to use the Find() and FindRows() methods in this section.. Finding the Index of a DataRowView Using...

Finding, Filtering, and Sorting Rows in a DataTable

tailieu.vn

Each row in a DataTable is stored in a DataRow object, and in this section you'll learn how to find, filter, and sort the DataRow objects in a DataTable.. Retrieve the rows from the database into your DataTable.. Call the Find() method of your DataTable, passing the primary key column value of the DataRow you want.. productsDataTable.PrimaryKey = new DataColumn[]....

Fundamentals of Transact-SQL

tailieu.vn

In this section, you'll learn some of the essential programming constructs available in T- SQL. Specifically, you'll see how to use variables, comments, and conditional logic.. You'll also see how to use a number of statements that allow you to perform jumps and loops. Finally, you'll examine cursors, which allow you to process rows returned from the database one at...

Introducing Databases

tailieu.vn

A database is an organized collection of information. A relational database is a. collection of related information that has been organized into structures known as tables.. Each table contains rows that are further organized into columns. You should already be familiar with information being represented in the form of a table with columns. For example, Table 2.1 shows the details...

Introducing Stored Procedures

tailieu.vn

Introducing Stored Procedures. SQL Server allows you to store procedures in a database. Stored procedures differ from user-defined functions in that procedures can return a much wider array of data types.. You'll typically create a stored procedure when you need to perform a task that. intensively uses the database, or you want to centralize code in the database that any...

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...