Everything is achievable through technology


1. Distict Column in Dataset

string[] TobeDistinct = {“Name”,”City”,”State”};
DataTable dtDistinct = GetDistinctRecords(DTwithDuplicate, TobeDistinct);

//Following function will return Distinct records for Name, City and State column.
public static DataTable GetDistinctRecords(DataTable dt, string[] Columns)
DataTable dtUniqRecords = new DataTable();
dtUniqRecords = dt.DefaultView.ToTable(true, Columns);
return dtUniqRecords;

2. Search Field

DataSet ds = new DataSet();
DataRow[] foundRows;
foundRows = ds.Tables[0].Select(“MerchantName LIKE ‘%'”, “MerchantName”);

DataTable DataTable2 = new DataTable();
DataTable2 = ds.Tables[0].Clone();
foreach (DataRow dr in foundRows)
ds.tables[0].rows.add(DataTable2); // error table already exists.

3. Dataset Min and Max Values

string DSMIN= (string)DS.Compute(“Min(Year)”, null);
string DSMAX= (string)DS.Compute(“Max(Year)”, null);

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s