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
Naeem Khan
975
802
799.5k
Problem in DataGridView using c#
Nov 11 2009 2:13 PM
Hello every one, Well in My DataGridView have Chekboxes which is Called From DB . i want to insert checkboxes selected values Data Base. and this is my code. when i click the save button so on that time it is saved a lots of rows at one time click but i want that when i click save button only select one row if you have any idea then let me know... try { con = new MySqlConnection("Server=localhost;user id =root;Password=.;DataBase=test"); con.Open(); foreach (DataGridViewRow dataGridRow in dataGridView1.Rows) { if (dataGridRow.Cells[0].Value != null && (bool)dataGridRow.Cells[0].Value) { cmd = new MySqlCommand("Insert into t_calculation values(" + dataGridView1.Rows[0].Cells[0].Value + "," + dataGridView1.Rows[0].Cells[1].Value + "," + dataGridView1.Rows[0].Cells[2].Value + "," + dataGridView1.Rows[0].Cells[3].Value + ")", con); cmd.ExecuteNonQuery(); MessageBox.Show("Inserted"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.Close(); } thanks in Advance
Reply
Answers (
1
)
Passing MultiDimensional Arrays to a method in C#
Prolem in DataGridView using c#