Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Experts,
C#
protected void btnUpdae_Click(object sender, EventArgs e)
        {
       
          
            SqlDataAdapter daq;
            string connection = System.Configuration.ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
            using (SqlConnection con = new SqlConnection(connection))
            {
                con.Open();
                daq = new SqlDataAdapter("update TextAnswers set Comments='" + grdView.Rows[1].Cells[5].Controls[0] + "', Marks=" + grdView.Rows[1].Cells[5].Controls[0] + " where Emp_ID=" + grdView.Rows[1].Cells[5].Controls[0] + "UserName='" + Request.QueryString["UserName"] + "'", con);
                SqlCommandBuilder sb = new SqlCommandBuilder(daq);
                sb.ConflictOption = ConflictOption.OverwriteChanges;

                daq.RowUpdated += new SqlRowUpdatedEventHandler(daq_RowUpdated);

                sb.ConflictOption = ConflictOption.CompareAllSearchableValues;

 
            }

          
        }


Thank in advance your valuable replay
Posted
Updated 22-Nov-11 20:51pm
v3
Comments
sriman.ch 23-Nov-11 5:06am    
Give some more details....`
2011999 23-Nov-11 5:25am    
in grid view default edit update is taken. but but don't want to default edit update change. whenever store data in grid view simultaneously update the database also. hole grid view one update button whenever change in grid view after that click update button update the data in gridview

1 solution

hi,
please explain clearly your explaination is little bit confusing
 
Share this answer
 
Comments
2011999 23-Nov-11 7:35am    
Exact my requirement is whenever update a row in grid view. update data. but button is taken outside the grid view. not inside gridview

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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