background preloader


Facebook Twitter

Using Calculated DataColumns in ADO.NET. By Mike Gunderloy 05/27/2003 If you have a background in database work, you have undoubtedly run into the rules of normalization.

Using Calculated DataColumns in ADO.NET

In particular, you probably internalized the rule that you should not store derived data in the database. For example, if your database includes an Order Details table containing columns for Price and Quantity, you should not put an Item Total column in that table. The item total can always be calculated from the price and quantity when it's needed. By not storing the calculated column, you avoid having to update it whenever the data in one of the other columns changes. But even though ADO.NET's DataSet class is sometimes described as a "relational database in memory," it's important to remember that there are differences between databases and DataSets. A Simple Example To demonstrate calculated DataColumns in action, I'll build a very simple C# Windows Forms application.

Assuming you've done work with ADO.NET, this code should look very familiar. References. DataGridView: Select Rows and retrieve the values of the cells. HOW TO: Populate a TreeView Control from a Dataset in Visual Basic .NET. This step-by-step article describes how to display data from a hierarchical dataset by using the TreeView control in Microsoft Visual Basic .NET.

HOW TO: Populate a TreeView Control from a Dataset in Visual Basic .NET

To do this, you establish a parent, child, and grandchild relationship, and then fill the TreeView control appropriately. The TreeView control has a Nodes collection with root TreeNode objects. Each TreeNode object has its own Nodes collection that holds more than one child TreeNode object. You can then use the TreeView control to work down from the parent or root node to the corresponding child nodes and display the appropriate data. This example creates a hierarchical dataset, loops through each table, and adds nodes to the TreeView control for each child table in the dataset.

Requirements Create the Project and Add Code For additional information about populating a TreeView control in Visual Basic .NET, click the article number below to view the article in the Microsoft Knowledge Base: ( ) Optimizing MERGE Statement Performance. In SQL Server 2008, you can perform multiple data manipulation language (DML) operations in a single statement by using the MERGE statement.

Optimizing MERGE Statement Performance

For example, you may need to synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table. Typically, this is done by executing a stored procedure or batch that contains individual INSERT, UPDATE, and DELETE statements. However, this means that the data in both the source and target tables are evaluated and processed multiple times; at least once for each statement. To improve the performance of the MERGE statement, we recommend the following index guidelines: How do I... Reseed a SQL Server identity column? SQL script for creating date dimension table for a data warehouse at

Almost all data warehouses enable the user to analyse and summarize data in sectors of time.

SQL script for creating date dimension table for a data warehouse at

Reports are often based on the financial year, the last quarter, last month or last week etc. By building a date dimension table in our data warehouse we provide a reuseable date lookup table that can help ease the creation of date based reports. This article demonstrates a SQL script that can be used to create and populate such a date dimension table. The following SQL script creates the table structure: CREATE TABLE dbo.Dates ( DateID int NOT NULL IDENTITY(1, 1), [Date] datetime NOT NULL, [Year] int NOT NULL, [Month] int NOT NULL, [Day] int NOT NULL, [QuarterNumber] int NOT NULL, CONSTRAINT PK_Dates PRIMARY KEY CLUSTERED (DateID) ) Now the table has been created we can fill it with data. Datagrid columns c# Visual Basic style combobox DataGrid Columns .NET assembly for VB, C#, C++,ilasm,ildasm,decompile,obfuscate,reflector. Lesson 9: Databinding using Visual Basic. Article 2 - Display data using DataSet and DataGrid controls through Whidbey (VB.NET)

Introduction My previous article explains about the step by step dynamic creation of a SQL Server database, tables, and stored procedure using Visual Studio codename Whidbey and VB.NET.

Article 2 - Display data using DataSet and DataGrid controls through Whidbey (VB.NET)

I hope that you got a good start up in dynamic creation of SQL Server database and tables. This article explains how we can display data using DataSet and DataGrid controls after the database is created. About “DataTable” and “DataSet” Objects A DataSet is a major component of ADO.NET architecture. For example, if you named a DataTable as “MyTable” and if you defined the table as “Mytable”, it won’t look for the table because DataTable name is case sensitive. Some of the public properties of DataTable are shown below: Properties Description CaseSensitive This property returns a Boolean value which checks if the table name is case-sensitive.

Some of the public methods of a DataTable are shown below: About “SQLDataAdapter” Class There are two methods used for adding or updating records. About DataGrid Control.