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
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