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
kamal dhillon
NA
23
13.9k
how can remove this error index was out of range ????????
Sep 26 2012 3:56 PM
private void button1_Click(object sender, EventArgs e)
{
SqlCommand delcmd = new SqlCommand();
string empid = Convert.ToString("@empid");
while (true)
{
if (dataGridView1.Rows.Count > 1 && dataGridView1.SelectedRows[0].Index != dataGridView1.Rows.Count - 1 )/////////////error
{
delcmd.CommandText = "DELETE FROM registrationn WHERE empid=" + dataGridView1.SelectedRows[0].Cells[0].Value.ToString() + "";
con.Open();
delcmd.Connection = con;
delcmd.ExecuteNonQuery();
con.Close();
dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
MessageBox.Show("Employee deleted");
}
}
Reply
Answers (
1
)
how to store date time values in database and also i want to store screenshot pictures in particular folder ????
Is the DbContext class defined and used differently in the version of C# for Visual Studio 2012 than in Visual Studio 2010?