EDN Admin
Well-known member
I am working on 3 tier architecture and in DAL i have a method getdata and i want to create a business object in BAL but the method is not static so i am unable to access it in BAL,so i used static keyword then i am having problem in my UI.
DAL code
<pre class="prettyprint" style=" public static XDocument getdata()
{
XDocument main = XDocument.Load(HttpContext.Current.Server.MapPath("~/XMLFile2.xml"));
return main;
}[/code]
in my BAL
<pre class="prettyprint" style=" public void dataret()
{
ProfileMasterDAL.getdata();
}[/code]
in UI
<pre class="prettyprint" style=" ProfileMasterDAL pmdal = new ProfileMasterDAL();
var query = from user in pmdal.getdata().Descendants("country")
where user.Element("name").Value == st
from t in user.Descendants("text")
select t.Value;[/code]
<br/>
but here i am getting an error at getdata as Cannot access static method getdata in non-static context.If i remove the static keyword i am unable to access getdata in BAL... how to solve this?
<br/>
View the full article
DAL code
<pre class="prettyprint" style=" public static XDocument getdata()
{
XDocument main = XDocument.Load(HttpContext.Current.Server.MapPath("~/XMLFile2.xml"));
return main;
}[/code]
in my BAL
<pre class="prettyprint" style=" public void dataret()
{
ProfileMasterDAL.getdata();
}[/code]
in UI
<pre class="prettyprint" style=" ProfileMasterDAL pmdal = new ProfileMasterDAL();
var query = from user in pmdal.getdata().Descendants("country")
where user.Element("name").Value == st
from t in user.Descendants("text")
select t.Value;[/code]
<br/>
but here i am getting an error at getdata as Cannot access static method getdata in non-static context.If i remove the static keyword i am unable to access getdata in BAL... how to solve this?
<br/>
View the full article