Link to home
Start Free TrialLog in
Avatar of NaumLitvin
NaumLitvin

asked on

Namespace issues creating DAL with C#

Hi,

I am trying to learn building DAL/BLL per available tutorials adapting them to my data. Apparentli missing some basic "plumbing" knowledge. Help would be appreciated...

1) I built .xsd data source with table adapter "FormulaParameterTableAdapter" in it (see FP3_02.jpg)

2) I created folders structure in my A_TAdmin2 project (App_Code, DAL). dsFP3.xsd is in DAL folder

3) In Admin_FP3.aspx.cs file I put
using FormulaParameterTableAdapter;
but still Visual Studio does not see it...

How I tell it to look in App_Code/DAL/dsFP3.xsd ???

4) At this (beginning) point all I want is to show table FormulaParameter - is my C# code going to do that? Last 3 lines look suspicious to me...

5) I am working with tutorials by Scott Gu from
http://weblogs.asp.net/scottgu/archive/2006/01/15/435498.aspx
can someone point me to other step-by-step tutorials teaching how to do DAL/BLL data access in C#?

6) Do I need to post more code? .aspx at this point just has few lines for GridView GW1...
did not code DetailsView yet...

thanks
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FormulaParameterTableAdapters;
 
namespace A_TAdmin2
{
    public partial class Admin_FP3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e);
 
          private FormulaParameterTableAdapter _FP3Adapter = null;
            protected FormulaParameterTableAdapter Adapter
            {    get 
                { if (_FP3Adapter == null)
                    _FP3Adapter = new FormulaParameterTableAdapter();
                   return _FP3Adapter; 
                }
                set
                {
                    GW1.DataSource = _FP3Adapter.GetData_FP3();
                    GW1.DataBind();
                }
            }
        
    }
}

Open in new window

FP3-02.jpg
FP3-01.jpg
Avatar of guru_sami
guru_sami
Flag of United States of America image

I think you should use
               using dsFP3TableAdapters;
instead of
       using FormulaParameterTableAdapters;
Just type --- using dsF --- and then press Ctrl + Space and the VS intellisense will detect the rest for you.


Avatar of NaumLitvin
NaumLitvin

ASKER

Hey, thanks!

With your hint I managed to get correct USING (I hope) - see attached - it makes sense and explains how to point code to the right folder...

Now I got tow other errors that are above my head...

Probably I need to re-arrange lines in my code, maybe have Page_Load after _FP3Adapter?
DataBind seems to belong in Page_Load, though, not in _FP3Adapter definition?
Or in Page_Load I just need to call the SET method of _FP3Adapter?
See, how I am kinda lost here...


FP3-03.jpg
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you! I also found how to connect the code to the adapter (by properly coding the USING statement).