How to create a DataView in C#

DataView is special table view which allows you to traverse through rows and columns respectively. C# DataView is an offline data holder as DataSet.

What you need is

  1. A Database connection object
  2. A Data Adapter which configures the data table using SQL query.
  3. And a dataset which holds the table information.

Create a data view object and initialize it with the dataset tables name as follows

SqlDataAdapter AccountRegistration = new SqlDataAdapter(“select * from accountregistration order by grpid”, Common.con);

DataSet AccountRegistrationDataset=new DataSet();
DataView AccountRegistrationTableView = new DataView(AccountRegistrationDataset.Tables[0]);

Learn about more DatView operations


Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.