I'm using nested datareader in my program which returns an exception as follows: "There is already an open DataReader associated with this Command which must be closed first."
When i alter the connection with MARS as set true, i get another exception as :"Invalid attempt to read when no data is present."
My code is as follows:
What i have to do. Can someone help me?
When i alter the connection with MARS as set true, i get another exception as :"Invalid attempt to read when no data is present."
My code is as follows:
Code:
Private Sub RecGGET_Click()
Dim dr As DataRow = DTGrid3.NewRow
Dim vRs As SqlClient.SqlDataReader
Dim vSqlText As String
Dim vSql As SqlClient.SqlCommand
DTGrid3.Clear()
vSqlText = "Select DevoteeName, GStr from B_Devotee where GID = 1 order by DevoteeName"
vSql = New SqlClient.SqlCommand(vSqlText, cnnRice)
vRs = vSql.ExecuteReader
vSql = Nothing
Do While vRs.Read
dr("Head_Name") = vRs("DevoteeName")
PrevVStr = vRs("GSTR")
dr("Members_Name") = GET_Name()
Loop
DTGrid3.Rows.Add(dr)
DTGrid3.AcceptChanges()
Grid3.DataSource = DTGrid3
Grid3_Clear()
vRs.Close()
cmdGEdit.Enabled = False
cmdGDelete.Enabled = False
End Sub