Có 120+ tài liệu thuộc chủ đề "kĩ thuật lập trình"
tailieu.vn Xem trực tuyến Tải xuống
The GetSql* methods and Sql* types are defined in the System.Data.SqlTypes. namespace, and they are specific to SQL Server. In addition, the GetSql* methods are specific to the SqlDataReader class. Using the GetSql* methods and Sql* types helps prevent type conversion errors caused by loss of precision in numeric values.. The GetSql* methods are also faster than their Get* counterparts....
tailieu.vn Xem trực tuyến Tải xuống
The form will also feature a Button control, which when pressed will set the Text property of one of the Label controls to a string containing the user's name, gender, and favorite season. Figure 15.4 shows how your final form will appear.. Figure 15.4: The appearance of the final form Perform the following steps:. Now, add the four Label controls...
tailieu.vn Xem trực tuyến Tải xuống
The CustomerID and CompanyName columns from the Customers table. The OrderID and OrderDate columns from the Orders table. The ProductID and Quantity columns from the Order Details table. To start building the query, select the Customers table in Enterprise Manager from the Tables node of the Databases folder for the Northwind database. This opens the query builder, as shown in...
tailieu.vn Xem trực tuyến Tải xuống
To interact with either of these databases in your program, you use classes from the System.Data.OleDb namespace. You'll learn more about the System.Data.OleDb namespace in Chapter 5, "Overview of the ADO.NET Classes.". Connecting to an Access Database. You connect to an Access database using an OleDbConnection object-rather than a SqlConnection object-with a connection string of the following format:. provider=Microsoft.Jet.OLEDB.4.0;data source=databaseFile....
tailieu.vn Xem trực tuyến Tải xuống
To create a SqlCommand object using Visual Studio .NET (VS .NET), you drag a. SqlCommand object from the Data tab of the Toolbox to your form. Add a SqlConnection object to your project (refer back to the previous chapter to see how to add a SqlConnection object using VS .NET). Drag a SqlCommand object to your form. Figure 8.1 shows...
tailieu.vn Xem trực tuyến Tải xuống
You can also drag an. Figure 7.1 shows a form with a SqlConnection object. Figure 7.1: Creating a SqlConnection object with Visual Studio .NET. Once you've created a SqlConnection object, that object appears in the "tray". You can of course still work with them visually when designing your form.. To set the ConnectionString property that specifies the details of the...
tailieu.vn Xem trực tuyến Tải xuống
When you drag a SqlDataAdapter object to your form, you start the Data Adapter Configuration Wizard, as shown in Figure 10.8.. Figure 10.8: The Data Adapter Configuration Wizard Click the Next button to continue.. Pick your connection to the Northwind database (or create a new connection if you don't have an existing one), as shown in Figure 10.9.. Figure 10.9:...
tailieu.vn Xem trực tuyến Tải xuống
Figure 10.14: The Generate Dataset dialog box. Figure 10.15: The new DataSet object in the tray. Figure 10.16 shows the running form.. Figure 10.16: The running form
tailieu.vn Xem trực tuyến Tải xuống
Creating a DataView Using Visual Studio .NET. In this section, you'll learn how to create a DataView using Visual Studio .NET (VS .NET). You can follow along with the steps described in this section:. Open VS .NET and create a new Windows application named myDataView.. Display Server Explorer, connect to your Northwind database, and drag the Customers table to your...
tailieu.vn Xem trực tuyến Tải xuống
Console.WriteLine("myFKC.AcceptRejectRule = ". myFKC.AcceptRejectRule);. Console.WriteLine("Columns:");. foreach (DataColumn myDataColumn in myFKC.Columns). Console.WriteLine("". Console.WriteLine("myFKC.ConstraintName = ". myFKC.ConstraintName);. Console.WriteLine("myFKC.DeleteRule = ". myFKC.DeleteRule);. Console.WriteLine("RelatedColumns:");. foreach (DataColumn relatedDataColumn in myFKC.RelatedColumns). Console.WriteLine relatedDataColumn);. Console.WriteLine("myFKC.RelatedTable = ". myFKC.RelatedTable);. Console.WriteLine("myFKC.Table = ". myFKC.Table);. Console.WriteLine("myFKC.UpdateRule = ". myFKC.UpdateRule);. myFKC.AcceptRejectRule = None Columns:. myFKC.ConstraintName = ForeignKeyConstraintCustomersOrders myFKC.DeleteRule = Cascade. myFKC.RelatedTable = Customers myFKC.Table = Orders. myFKC.UpdateRule = Cascade
tailieu.vn Xem trực tuyến Tải xuống
Creating a Simple ASP.NET Web Application Using VS .NET. In this section, you'll see how to create a simple ASP.NET Web application that contains a text box and a button using VS .NET. You'll learn how to deploy this application to Microsoft's Internet Information Server (IIS). You'll also see how to run the example Web application from Internet Explorer.. Note...
tailieu.vn Xem trực tuyến Tải xuống
Creating a Simple Shopping Cart Application. In this section, you'll modify your DataGridWebApplication you created earlier to turn it into a simple shopping cart. You'll store the shopping cart in a Session object.. Note As mentioned in the previous section, in a real application you'll probably want to store the shopping cart in the database rather than in a Session...
tailieu.vn Xem trực tuyến Tải xuống
Creating a SqlCommand Object. There are two ways you can create a SqlCommand object:. Creating a SqlCommand Object Using a Constructor. Before you use a SqlCommand object you first need a SqlConnection object, which is used to communicate with a SQL Server database:. Next, you can create a new SqlCommand object using the following statement:. In the next section, you'll...
tailieu.vn Xem trực tuyến Tải xuống
Creating a SqlDataReader Object. You can create a DataReader object only by calling the ExecuteReader() method of a Command object. Command objects were covered in the previous chapter. For example, the following code creates the required objects and executes a SELECT statement that retrieves the top five rows from the Products table of the SQL Server Northwind database, storing the...
tailieu.vn Xem trực tuyến Tải xuống
You can use Enterprise Manager to add a table to a database. In this section, you'll add a table to the Northwind database to store the details of a person. This table will be called Persons, and will contain the columns shown in Table 2.8.. Table 2.8: DEFINITION FOR THE COLUMNS OF THE Persons TABLE COLUMN NAME DATABASE TYPE LENGTH...
tailieu.vn Xem trực tuyến Tải xuống
foreach (DataColumn myDataColumn in myUC.Columns). Console.WriteLine("myUC.ConstraintName = ". myUC.ConstraintName);. Console.WriteLine("myUC.IsPrimaryKey = ". myUC.IsPrimaryKey);. Console.WriteLine("myUC.Table = ". myUC.Table);. myUC.ConstraintName = UniqueConstraintCustomerID myUC.IsPrimaryKey = True. myUC.Table = Customers
tailieu.vn Xem trực tuyến Tải xuống
In this section, you'll learn how to create a DataRelation object to define a relationship between two DataTable objects that hold some rows from the Customers and Orders tables. As you know, the CustomerID column of the child Orders table is a foreign key that links to the CustomerID column of the parent Customers table.. Once you've created a DataRelation,...
tailieu.vn Xem trực tuyến Tải xuống
myDataTable specifies the DataTable that your DataView is associated with. Your DataView will read the rows from this DataTable. The Table property of your DataView is set to myDataTable.. filterExpression specifies a string containing the expression you want to filter the rows by. The RowFilter property of your DataView is set to filterExpression.. sortExpression specifies a string containing the expression...
tailieu.vn Xem trực tuyến Tải xuống
myDVM.DataViewSettings["Customers"].Sort = "CustomerID";. myDVM.DataViewSettings["Customers"].RowFilter = "Country = 'UK'";. DataView customersDV = myDVM.CreateDataView(customersDT);. set the Sort and RowFilter properties for the Customers DataTable myDVM.DataViewSettings["Customers"].Sort = "CustomerID";. display the DataViewSettingCollectionString property of myDVM Console.WriteLine("myDVM.DataViewSettingCollectionString = ". myDVM.DataViewSettingCollectionString + "\n");. myDVM.DataViewSettingCollectionString = <DataViewSettingCollectionString>
tailieu.vn Xem trực tuyến Tải xuống
Creating Child DataView Objects. You can create a child DataView from a parent DataRowView using the. CreateChildView() method. You can then view the DataRowView objects from the child DataView. To call the CreateChildView() method, you must first add a DataRelation to the DataSet that defines a relationship between the two underlying DataTable objects.. Assume you have two DataTable objects named....