RcBuilder@walla.com
call centre: 054-5614020

custom DataTable

Posted by: RcBuilder  /   Category: abstract / ADO.NET / DataColumn / DataRow / DataTable / DefaultView / Entities / Generic T / inheritance / OOP / SOURCE CODE   /   No Comments
11
Jan
2015

custom DataTable namespace CSCode.DataTables { public abstract class baseDataTable { protected DataTable dataTable; public int RowsCount { get { return this.dataTable.Rows.Count; } } public void Sort(string SortColumn) { var view = this.dataTable.DefaultView; view.Sort = SortColumn; this.dataTable = view.ToTable(); } public void ReplaceString(string ColumnName, string OldValue, string NewValue) { foreach (DataRow row in this.dataTable.Rows) try { row.SetField<string>(ColumnName, row.ToString().Replace(OldValue, NewValue)); } catch { } } public object GetSpecificValue(int RowIndex, string ColumnName) { return this.dataTable.Rows; } public static explicit operator DataTable(baseDataTable me) { return me.dataTable; } public static.

Read more

DefaultView ToTable

Posted by: RcBuilder  /   Category: ADO.NET / DataTable / DefaultView   /   No Comments
08
Sep
2014

DefaultView ToTable var data = new DataTable(); data.Columns.Add("Id"); data.Columns.Add("Name"); data.Columns.Add("Email"); data.Columns.Add("Age"); data.Rows.Add(1, "Roby", "roby@mail.com", 35); data.Rows.Add(4, "Maayan", "maayan@mail.com", 30); data.Rows.Add(3, "Ronen", "ronen@mail.com", 39); data.Rows.Add(2, "Avi", "avi@mail.com", 33); var view_data = data.DefaultView.ToTable(false, "Id", "Name"); foreach (DataRow row in view_data.Rows) Console.WriteLine(row); Console.WriteLine(); var view2 = data.DefaultView; view2.Sort = "Name desc"; var view_data2 = view2.ToTable(false, "Id", "Name"); foreach (DataRow row in view_data2.Rows) Console.WriteLine(row); Console.WriteLine(); var view3 = data.DefaultView; view3.RowFilter = "Age > 35"; var view_data3 = view3.ToTable(false, "Id", "Name"); foreach (DataRow.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים