Start New Discussion within our Software Development Community

Hi, i am getting an error like invalid attempt to read when reader is closed

Try
            Dim k As Integer = 0
            Dim l As Integer = 0
            Dim str_select As String = "select * from Suggetion_master where que_no=" & FrmErrorQuestions.dtgErrorQue.Item(0, FrmErrorQuestions.dtgErrorQue.CurrentRow.Index).Value
            dtgQueSuggestion.RowCount = 1
            nxtlsdquescon.Open()
            cmd = New SqlCommand(str_select, nxtlsdquescon)
            ' cmd.Connection.Open()
            cmd.ExecuteReader()
            Do While (dr.Read)
                k = k + 1
                dtgQueSuggestion.RowCount = dtgQueSuggestion.RowCount + 1
                dtgQueSuggestion.Rows(l).Height = 150
                dtgQueSuggestion.Item(1, l).Value = k
                dtgQueSuggestion.Item(1, l).Value = dr.Item("suggetion")
                l = l + 1
            Loop
            nxtlsdquescon.Close()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

can anybody help me

This question has already been answered. Start a new discussion instead.