Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagridview update

Status
Not open for further replies.

bharathi228

Programmer
Feb 12, 2009
12
Hi,

iam working with windows application.here my requirement is binding data to database from a datagridview.
next i want to update some rows in datagridview and update it to the database.for this purpose i need for each row loop in datagridview.i dont know how to update
the selected row in the datagridview.here my code in asp.net is like this.its working fine.but i want to do this in datagridview in windows application.

For Each row As GridViewRow In Gridview1.Rows
Dim rbl1 As RadioButtonList = CType(row.FindControl("RadioButtonList"), RadioButtonList)
Label1.Text = CType(row.FindControl("LabelTno"), Label).Text
Label2.Text = CType(row.FindControl("LabelBr_id"), Label).Text
Label3.Text = CType(row.FindControl("RadioButtonList1"), RadioButtonList).SelectedValue
Dim cmd4 As New SqlCommand("update report_parameters set parameter_status='" & Label3.Text & "' where report_index=" & Label1.Text & " and parameter_name='" & Label2.Text & "'", con)
If con.State = Data.ConnectionState.Closed Then
con.Open()
End If
cmd4.ExecuteNonQuery()
con.Close()
Next
 
Did you see my answer in your related thread?

thread796-1532666
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top