TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kinjal Sonachhatra
NA
101
20.9k
Update button Condition
Dec 19 2018 12:07 AM
private void btnUpdate_Click(object sender, EventArgs e)
{
Entity ent = new Entity();
BAL b = new BAL();
ent.intId = (int)gvData.SelectedRows[0].Cells["Id"].Value;
if (ent.intId != 0)
{
ent.strEmail = txtEmail.Text;
ent.strName = txtName.Text;
ent.strSalary = txtSalary.Text;
DL dl = new DL();
dl.Update(ent);
DataTable dt = dl.Display(ent);
gvData.DataSource = dt;
}
b.Clear(ent);
txtEmail.Text = txtName.Text = txtSalary.Text = " ";
}
Hello,
This is my Code for update. Now i want to put condition for update. Like if I put new record and by mistake I click Update then I got ("Index was out of range. Must be non-negative and less than the size of the collection.") Error. So I want to remove it.
If you have any idea then Please Suggest.
Thanks in advance
Reply
Answers (
1
)
DateTime Format in C#
Total Count divided range calculation in c#