Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

type used in using statement must be implicitly convertible to System.IDisposable

$
0
0

Hello,

I am using a 'using' statement in a web form, and datacontext is in a classlibrary which I have added in a seperate project and I am adding reference of this in my web site.

If I use dbml file in website itself then 'using' works fine but when I use dbml file in classlibrary project then it gives me the following error:

"type used in using statement  must be implicitly convertible to System.IDisposable"

For this I have inhirited IDisposable interface also but same error persist.

using System.Web.UI.WebControls;
using ClassLibrary1;

public partial class _Default : System.Web.UI.Page, IDisposable
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (DataClassesDataContext myDataContext = new DataClassesDataContext())
        {
        }
    }
}

Please tell me what is work around so that it may work.

Thanks


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>