Reputation: 61
have small problem here. heres the code:
using (LINKSEntitiesMaster LE = new LINKSEntitiesMaster())
{
Cache["ALLDB"] = LE;
}
internal void FilterDB(string ParentPageTitle, string ButtonName)
{
var ALLdb = (LINKSEntitiesMaster)Cache["ALLDB"];
var x = ALLdb.MainTables.Where(s => s.Language == ParentPageTitle && s.ButtonName == ButtonName).Select(w => w.AllLinks).ToList();
Links.DataSource = ALLdb;
Links.DataBind();
}
the error is in the topic. i save the filterd DB to a list,cant see why the connection closed...?
i been searching but could not fined an answer.
Upvotes: 0
Views: 238
Reputation: 745
Connection is likely being closed since LINKSEntitiesMaster LE = new LINKSEntitiesMaster()
is wrapped in a using statement. Once you code goes outside the using
scope LINKSEntitiesMaster
gets disposed.
Upvotes: 1