Invalid attempt to call Read when reader is closed.
-
While try to execute this code i get an error message " Invalid attempt to call Read when reader is closed." Public Shared Function GetLMSSettings() As Hashtable Dim h As Hashtable h = CType(DataCache.GetCache("GetLMSSettings"), Hashtable) If h Is Nothing Then h = New Hashtable Dim dr As IDataReader = SqlDataProvider.GetLMSSettings While dr.Read() If Not dr.IsDBNull(1) Then h.Add(dr.GetString(0), dr.GetString(1)) Else h.Add(dr.GetString(0), "") End If End While dr.Close() DataCache.SetCache("GetLMSSettings", h) End If Return h End Function
-
While try to execute this code i get an error message " Invalid attempt to call Read when reader is closed." Public Shared Function GetLMSSettings() As Hashtable Dim h As Hashtable h = CType(DataCache.GetCache("GetLMSSettings"), Hashtable) If h Is Nothing Then h = New Hashtable Dim dr As IDataReader = SqlDataProvider.GetLMSSettings While dr.Read() If Not dr.IsDBNull(1) Then h.Add(dr.GetString(0), dr.GetString(1)) Else h.Add(dr.GetString(0), "") End If End While dr.Close() DataCache.SetCache("GetLMSSettings", h) End If Return h End Function