Hi all,

I have a COM component on my test server that my application uses to connect to a database.

I am trying to set up a single class to interact with the object. I am using the Marshal.ReleaseComObject method to "free up" the object once I'm done with it.

The problem is that this works the first time, but doesn't work on subsequent tries. Am I using the method improperly?

For example, in one of my classes, I send an SQL statement to the function that executes the queries, the query is executed, then I call the function to release the object. However, if I try to execute another query, I get nothing. Am I using this wrong?

I hovered over the top of the class where I instantiate the object, and I get a "Attempted to read or write protected memory...." error.

edit: I should note this is a web application, but I'm not sure if that matters. If so, mods feel free to move this to the appropriate section.