Good One

Treeview query

SELECT  P1.emp
FROM Personnel AS P1, Personnel AS P2
WHERE P1.lft BETWEEN P2.lft AND P2.rgt

Update multiple

public static int Update(DataTable dtNewCategory, int PageIndex, int PageSize)
DataTable dtOldCategory = new DataTable();
int count = 0;

dtOldCategory = CategoryBAL.Get(0, PageIndex, PageSize);
CategoryInformation objCategoryInformation = new CategoryInformation();
for (int i = 0; i < dtOldCategory.Rows.Count; i++)
if (dtOldCategory.Rows[i][“CategoryName”].ToString() != dtNewCategory.Rows[i][“CategoryName”].ToString())
objCategoryInformation = Connection.objDemoDataContext.CategoryInformations.Single(m => m.CategoryId == Convert.ToDecimal(dtOldCategory.Rows[i][“CategoryId”]));
objCategoryInformation.CategoryName = dtNewCategory.Rows[i][“CategoryName”].ToString();
count += 1;
return count;


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

%d bloggers like this: