Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can any one help me,
i need to save the value in database from datagridview,if i give the value in one row then default empty row also coming. In loop condition i gave Save but that default row also taken and error occurs.
Posted
Updated 22-Sep-11 22:01pm
v2
Comments
walterhevedeich 23-Sep-11 4:58am    
You can use Improve question widget to edit your question and post the relevant code. That way, we can have a deeper understanding of your problem.

1 solution

It can be done by DataSet and dataTableAdapter by which the datagridview bind.

Ckeck your dataadapter have queies of Insert/delete/update

Take a button and on click of this button
C#
private void button2_Click(object sender, EventArgs e)
       {
           try
           {
               requesterTableAdapter.Update(requesterFileInventoryDataSet.Requester);
               MessageBox.Show("Record Updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
           }
           catch (Exception ex)
           {
               MessageBox.Show("Some Error in Update", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
           }

       }
 
Share this answer
 
Comments
vasanthkarthi 23-Sep-11 4:59am    
i put two button one for Add and another one Update
vasanthkarthi 23-Sep-11 5:13am    
and also how to avoid that row for save function,,

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