How to clear parameters after use of `db.Database.SqlQuery`

asp.net-mvc-5 c# entity-framework-6

Accepted Answer

ADO.Net objects (such asSqlParameter , SqlCommand brought to us by the (et cetera). The true, controlled material behind the hood is just a layer above the net structure. Internet connection pool. If a new one is madeSqlConnection This is impliedly carried out bydb.Database.SqlQuery We seldom ever create a new connection to the database. That would cost much too much. Actually, a connection in the connection pool is "plugged in" by our connection object.

Normally, this method is rather obvious, but problems like the one you're seeing here reveal it. I can recall experiencing similar problems (exceptions that persisted longer than met the eye).

You can't defeat it, so join it, is the message. Renaming the arguments in one of the methods seems to be the simple fix. Of course, factoring out the repetitive portion of your code into a method that has the same components is a better approach.

3
7/1/2016 9:11:38 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow