Tuesday, May 20, 2008

do not forget to Remove DataRowFilter value

If you are playing with datatable`s DefaultView view then don`t forget to change it to default mode by setting RowFilter property of DefaultView to string.Empty, otherwise you may get in to trouble.
Same happened with my one of colleague, and after 2 days debugging she came to me.

== here is full code

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DatatableTest
{
public class DataTableOperationWrapper
{
DataTable dtTable;

public bool ConstructDataTableAndFillData()
{
if (dtTable == null)
{
CreateTable();
}
else
{
dtTable.Rows.Clear();
dtTable.AcceptChanges();
}

DataRow dr = dtTable.NewRow();

for (int i = 0; i <>
{
dr["Name"] = "PersonName_" + i.ToString();
dr["Age"] = i; dtTable.Rows.Add(dr);
dr = dtTable.NewRow();
}

dtTable.AcceptChanges();
return true;
}

private void CreateTable()
{
dtTable = new DataTable();
dtTable.Columns.Add("Name", typeof(string));
dtTable.Columns.Add("Age", typeof(int));
}

public void ApplyDataViewRowFilter(string fileterCondition)
{
if (dtTable == null)
{
ConstructDataTableAndFillData();
}
dtTable.DefaultView.RowFilter = fileterCondition;
}
public DataTable GetResult()
{
if (dtTable == null)
{
new ApplicationException("DataTable is null");
}
return dtTable;
}
///
/// Remove the filters applied as DataRowFilter condition and get all the data from datatable.
///

public void RemoveDataViewRowFilter()
{
if (dtTable == null)
{
new ApplicationException("DataTable is null");
}
dtTable.DefaultView.RowFilter = string.Empty;
}
}
}

== till here

i just tried to set RowFilter value to string.Empty and it worked.
(Don`t get into design of class mentioned above.)

Thanks
Pradeep

Thursday, February 28, 2008

Health - Important Tips

Answer the phone by LEFT ear.
Do not drink coffee TWICE a day.
Do not take pills with COOL water.
Do not have HUGE meals after 5pm.
Reduce the amount of OILY food you consume.
Drink more WATER in the morning, less at night.
Keep your distance from hand phone CHARGERS.
Do not use headphones/earphone for LONG period of time.
Best sleeping time is from 10pm at night to 6am in the morning.
Do not lie down immediately after taking medicine before sleeping.
When battery is down to the LAST grid/bar, do not answer the phone as the radiation is 1000 times.
Forward this to those whom you CARE about!



---Thanks and care
Pradeep

Thursday, February 07, 2008

I am a Brainbench certified C# programmer !!!!!

I`ve heardabout brainbench from lot of people, so when i got this link, i thought to have some fun, and i am brainbench certified C# developer !!!!!!!!!

According to your survey i am about of 76% of people had accessment -- not bad.

here is details,
my Report card

http://www.brainbench.com/xml/bb/transcript/public/viewtranscript.xml?pid=7120700


-- thanks
Pradeep