Rajkumar R

Rajkumar R

  • NA
  • 183
  • 220k

'Rows' is not a member of 'System.Web.UI.WebControls.DataGrid'.

Mar 8 2012 1:09 AM
Here i m comparing GridView2.Rows(i).Cells(3).Text with reader(0)
but i m getting Error
Public Sub checkpipno()
        Dim i As Integer
        For i = 0 To GridView1.Rows.Count - 1
            Dim vr As String
            vr = GridView2.Rows(i).Cells(5).Text
            Dim village As String = GridView2.Rows(i).Cells(3).Text
            Dim con As New SqlConnection(connStr)
            con.Open()
            Dim sql As String = "SELECT pipno,pipcode1 FROM PIP_Entry WHERE Rpt_Unit = '" & village & "' "
            Dim cmd As New SqlCommand(sql, con)
            Dim reader As SqlDataReader = cmd.ExecuteReader()
            While reader.Read()
                If vr = reader(0).ToString() Then
                    GridView2.Rows(i).Cells(14).Text = reader(1).ToString()
                    GridView2.Rows(i).Cells(14).BackColor = System.Drawing.Color.FromName("Green")
                    GridView2.Rows(i).Cells(15).Text = "Done"
                    GridView2.Rows(i).Cells(15).BackColor = System.Drawing.Color.FromName("Green")
                End If
            End While
            reader.Close()
            con.Close()
        Next
    End Sub
The Above Code i have used to compare Grid view row with other table value i.e., in reader(0). But here i m getting error in VB.NET
That is 'Rows' is not a member of 'System.Web.UI.WebControls.DataGrid'.
Post Solution for this Post

Answers (3)