Hi,
iam working with windows application.her e 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.he re 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.FindC ontrol("RadioBu ttonList"), RadioButtonList )
Label1.Text = CType(row.FindC ontrol("LabelTn o"), Label).Text
Label2.Text = CType(row.FindC ontrol("LabelBr _id"), Label).Text
Label3.Text = CType(row.FindC ontrol("RadioBu ttonList1"), RadioButtonList ).SelectedValue
Dim cmd4 As New SqlCommand("upd ate report_paramete rs set parameter_statu s='" & Label3.Text & "' where report_index=" & Label1.Text & " and parameter_name= '" & Label2.Text & "'", con)
If con.State = Data.Connection State.Closed Then
con.Open()
End If
cmd4.ExecuteNon Query()
con.Close()
Next
iam working with windows application.her e 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.he re 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.FindC ontrol("RadioBu ttonList"), RadioButtonList )
Label1.Text = CType(row.FindC ontrol("LabelTn o"), Label).Text
Label2.Text = CType(row.FindC ontrol("LabelBr _id"), Label).Text
Label3.Text = CType(row.FindC ontrol("RadioBu ttonList1"), RadioButtonList ).SelectedValue
Dim cmd4 As New SqlCommand("upd ate report_paramete rs set parameter_statu s='" & Label3.Text & "' where report_index=" & Label1.Text & " and parameter_name= '" & Label2.Text & "'", con)
If con.State = Data.Connection State.Closed Then
con.Open()
End If
cmd4.ExecuteNon Query()
con.Close()
Next