I would very much appreciate it if anyone could give me a hint on this. From time to time I have encountered an error when using the OleDbDataAdapter.Fill() method. By the nature of the error, I would think it's a memory leak or something similar. This is my code snippet (in Visual Studio 2003):
OleDbDataAdapter da = new OleDbDataAdapter(); DataSet ds = new DataSet(); ADODB.Recordset rs; try { rs = (ADODB.Recordset)secProvider.LoadUsers(); // my COM object defined beforehand da.Fill(ds, rs, "UserReports"); } catch (Exception ex) { Response.Write("<b> <font color=\"red\"> " + ex.Message + "</font> </b>"); } finally { secProvider = null; if (rs.State == (int)ADODB.ObjectStateEnum.adStateOpen) rs.Close(); rs = null; da = null; ds = null; }
From time to time I got an "Unspecified error" or "Object reference not set to an instance of an object" right after the da.Fill() call. Can you spot out anything wrong with that? The error only occurs when this piece of code being called quite a number of times, and that makes me think it might be a memory leak sort of error.
Many thanks and have a great day,
Hien