satishkrshnn
New member
I get an error " INVALID ATTEMPT TO READ METADATA WHEN READER IS CLOSED" when i run my program.
Plz help me solve this problem.
Below is my Code.
Plz help me solve this problem.
Below is my Code.
Private Sub cmbstudentid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbstudentid.SelectedIndexChanged Try Call connection() sqlstr = "select _Name,_course_enro from Admission__details where _Eno like '%" & cmbstudentid.SelectedItem & "'" cmd = New SqlCommand(sqlstr, con) dr = cmd.ExecuteReader While dr.Read Me.txtname.Text = dr(0) Me.txtcourseenrolled.Text = dr(1) sqlstr2 = "select Cfees from Course_details where Cname like '%" & txtcourseenrolled.Text & "'" Dim cmd2 = New SqlCommand(sqlstr2, con) If con.State = ConnectionState.Closed Then con.Open() End If dr.Close() dr1 = cmd2.ExecuteReader If dr1.HasRows = True Then While dr1.Read Me.txtcoursefees.Text = dr(0) End While End If dr1.Close() End While Catch ex As Exception MsgBox(ex.Message) End Try con.Close() End Sub
Last edited by a moderator: