Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I m developing a Windows Form Application by using C# 2.0 and SQL Server 2005. In my application, I retrieve data by clicking a btnLoadData button from the database into a dataGridview contrl. Code sample to retrieve data:-
private void btnLoadData_Click(object sender, EventArgs e)
{
string s1 = "select * from Sales_Details";
SqlConnection cn = new SqlConnection(Class1.cs);
cn.Open();
SqlDataAdapter da = new SqlDataAdapter(s1, cn);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
cn.Close();
}
I want to update or edit a column of that dataGridview by clicking the column and save it back to the database by using the same ID. But I don't know how to do this, please someone help me.
Posted
Updated 11-Aug-13 19:33pm
v3

Try here: Auto Saving DataGridView Rows to a SQL Server Database[^]

It's not a new article, but it covers the technology you are using: .NET 2 and SQL 2005
 
Share this answer
 

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