Gridview : Update, delete and current cell and row

Update : Delete

object par1, par2, par3, par4, par5;
for (int i = 0; i < DGVAdminGrid.RowCount; i++)
{

par1 = DGVAdminGrid.Rows[i].Cells[“No”].Value.ToString();
par2 = DGVAdminGrid.Rows[i].Cells[“Username”].Value.ToString();
par3 = DGVAdminGrid.Rows[i].Cells[“Password”].Value.ToString();
par4 = P.UserID;
par5 = System.DateTime.Today.ToShortDateString();

string Q = “UPDATE [LB_User]SET [U_Username] = ‘” + par2 + “‘,[U_Password] ='” + par3 + “‘ ,[U_Modby] ='” + par4 + “‘,[U_ModDate] ='” + par5 + “‘ WHERE U_No='” + par1 + “‘”;

int k = lb.IUDRecord(Q);
if (k > 0)
{

}

}

Current Cell Value as well as Row
lblResourceType.Text = DGVResourceType.Rows[DGVResourceType.CurrentCell.RowIndex].Cells[“DESCRIPTION”].Value.ToString();

Advertisements

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 )

Connecting to %s

%d bloggers like this: