Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
This is my code what should I do further??


C#
for (j = 0; j < i; j++)
            {
                //MessageBox.Show(dataGridView1.Rows[j].Cells["Column8"].Value.ToString());

                if (Convert.ToBoolean(dataGridView1.Rows[j].Cells["Column8"].Value) == true)
                {
                    using (SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\tahathegreat\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\TT.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"))
                    {
                        conn.Open();
                        using (SqlCommand cmd = new SqlCommand("UPDATE [UInfo] SET [Checked]=@chk" + " WHERE SAPNo=@sno", conn))
                        {
                            cmd.Parameters.AddWithValue("@chk", "1");
                            cmd.Parameters.AddWithValue("@sno", dataGridView1.Rows[j].Cells["Column5"].Value);
                            int rows = cmd.ExecuteNonQuery();
                            //rows number of record got updated
                        }
                        conn.Close();
                    }
                }
            }
Posted
Comments
Himanshu Yadav 15-May-13 2:01am    
U can use findcontrol method thn check is it checked or not
Taha_Sadikot 15-May-13 2:04am    
can u please elaborate?
Sergey Alexandrovich Kryukov 15-May-13 2:30am    
Please, don't re-post. Besides, I just answered in detail...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900