D
deko
I'm having a problem trying to run methods in the DataAccess layer of my
WinForms app. I'm wondering if the problem is a result of the way I've
designed the interaction between the different layers.
I have my app organized in 3 projects and (for the sake keeping this simple)
4 classes:
App_DA
DataAccess.cs
Helper.cs
App_BL
BusinessLogic.cs
App_UI
FormMain.cs
In the constructor of the main form, I instantiate a Helper object:
public FormMain()
{
InitializeComponent();
Helper helper = new Helper();
}
which in turn instantiates a DataAccess object:
public Helper()
{
DataAccess da = new DataAccess();
}
The problem happens when I call a method in the DataAccess class from
FormMain:
private void button1_Click(object sender, EventArgs e)
{
DataAccess da = new DataAccess();
da.updateDataSet
}
The updateDataSet method is not updating the DataSet.
Could this be caused by the way I'm instantiating the objects in the
different layers?
Is it a bad idea to instantiate other objects in constructors like I am
doing here?
Thanks in advance.
WinForms app. I'm wondering if the problem is a result of the way I've
designed the interaction between the different layers.
I have my app organized in 3 projects and (for the sake keeping this simple)
4 classes:
App_DA
DataAccess.cs
Helper.cs
App_BL
BusinessLogic.cs
App_UI
FormMain.cs
In the constructor of the main form, I instantiate a Helper object:
public FormMain()
{
InitializeComponent();
Helper helper = new Helper();
}
which in turn instantiates a DataAccess object:
public Helper()
{
DataAccess da = new DataAccess();
}
The problem happens when I call a method in the DataAccess class from
FormMain:
private void button1_Click(object sender, EventArgs e)
{
DataAccess da = new DataAccess();
da.updateDataSet
}
The updateDataSet method is not updating the DataSet.
Could this be caused by the way I'm instantiating the objects in the
different layers?
Is it a bad idea to instantiate other objects in constructors like I am
doing here?
Thanks in advance.