[ Team LiB ] Recipe 8.5 Reading XML Data Directly from SQL Server Problem You need to read XML data directly from the SQL Server. Solution Use the FOR XML clause in the stored procedure or SQL statement. The C# code is shown in Example 8-8. Example 8-8. File
[ Team LiB ] Recipe 8.2 Saving and Loading a DataSet from XML Problem You need to save a DataSet as an XML file and create a DataSet from an XML file. Solution Use the XmlTextWriter and XmlTextReader classes. The sample code contains three event handlers
[ Team LiB ] Recipe 7.7 Displaying an Image from a Database in a Web Forms Control Problem You need to display an image from a database column in an ASP.NET control. Solution Fill an ASP.NET Image control from a database field by pointing the ImageUrl property
[ Team LiB ] Recipe 7.8 Displaying an Image from a Database in a Windows Forms Control Problem You need to display an image from a database in a Windows Forms control. Solution Read the image into a byte array and load it directly into a PictureBox control with a MemoryStream.
[ Team LiB ] Recipe 4.7 Updating a Data Source with Data from a Different Data Source Problem You want to update a data source using changes made to another data source for data replication or auditing purposes. Solution Use the GetChanges( )
[ Team LiB ] Recipe 5.1 Copying Rows from One DataTable to Another Problem You have records in a DataTable that you need to copy to another DataTable. Solution Use the ImportRow( ) method of the DataTable to copy DataRow objects from one DataTable to another.
[ Team LiB ] Recipe 10.11 Creating DataSet Relationships from SQL Server Relationships Problem You need to create relationships between DataTable objects within your DataSet at runtime based on the relationships that are defined in your SQL Server database.
22.3. Connecting from the Road You can also connect to your Mac's regular File Sharing feature (Chapter 13) from over the Internet. This feature is a blessing to anyone who travels, whether with a laptop or to a branch office,
[ Team LiB ] Recipe 2.17 Displaying Columns from a Related DataTable Problem You want to add a column to a DataTable that displays a value from a row in a related table in the DataSet. Solution Use expression columns to retrieve lookup values based on DataRelation objects.
[ Team LiB ] Recipe 2.20 Retrieving Data from an Oracle Package Problem Given an Oracle package that returns multiple result sets for related tables as REF CURSOR data types, you want to access this data using a DataReader and load the data into a DataSet. Solution Use the data type OracleType.Cursor .
[ Team LiB ] Recipe 3.6 Combining Data in Tables from Heterogeneous Data Sources Problem You want to create a report that is based on data from tables in more than one data source. Solution Use ad-hoc connector names in SQL statements.
[ Team LiB ] Recipe 4.3 Getting an AutoNumber Value from Microsoft Access Problem If you add a row into a Microsoft Access table that has an AutoNumber column, the value assigned to the column in the DataTable is replaced by a value generated by the database.
[ Team LiB ] Recipe 4.4 Getting a Sequence Value from Oracle Problem When you add a row into an Oracle table that uses a sequence to generate the value for a primary key column, the value assigned to the column in the DataTable is replaced by a value generated by the database.
[ Team LiB ] Recipe 6.9 Retrieving Constraints from a SQL Server Database Problem You need to programmatically define constraints in a DataSet and retrieve constraint information defined in a SQL Server database. Solution Use the INFORMATION_SCHEMA views and SQL Server system tables to get information about primary keys, foreign keys, and check constraints.
[ Tam LiB ] Recipe 10.3 Retrieving Column Default Values from SQL Server Problem The DataColumn object exposes a Default property. While the FillSchema( ) method of the DataAdapter returns schema information, it does not include the default values for columns.
[ Team LiB ] Recipe 10.15 Creating a Table in the Database from a DataTable Schema Problem You need to create a table in a database from an existing DataTable schema. Solution Use the CreateTableFromSchema( ) method shown in this solution.
[ Team LiB ] Recipe 3.11 Getting Typed DataRows from DataViews Problem When using a DataView to find rows in a typed DataSet, you want to convert the rows you find to typed DataRow objects having all the properties and methods defined in your typed DataSet.