Home > Computers and Internet > How to create typeDataset and use it programtically

How to create typeDataset and use it programtically

1. Add a Dataset in the project.
  
2. Create table and Column in the dataSet.
 
for Example
 
MyDataset   //Name of Dataset
MyTable     //Name of Table
 
Name       //Field
Code        //Field
Contact    //Field
 
3.How add a value in a table and display in grid.
 

private void LoadDataGrid()

{

MyDataset myDataSet=

new MyDataset();

MyDataset.MyTableDataTable myDataTable =myDataSet.MyTable ;

MyDataset.MyTableRow myDataRow=myDataSet.MyTable.NewMyTableRow ();

myDataRow.Name="sanjiv";

myDataRow.Code=123;

myDataRow.Contact="123345";

myDataSet.MyTable.AddMyTableRow(myDataRow);

dataGrid1.DataSource=myDataSet.MyTable ;

}

4. How to retrive the value

string name=myDataSet.MyTable[0].Name.ToString();

or

string name=myDataSet.MyTable[0][0].ToString();

 

 

 
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s

%d bloggers like this: