Namespace issues creating DAL with C#

Posted on 2009-04-29
Last Modified: 2013-12-17

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
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...

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; 




                    GW1.DataSource = _FP3Adapter.GetData_FP3();







Open in new window

Question by:NaumLitvin
    LVL 41

    Expert Comment

    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.


    Author Comment

    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...

    LVL 41

    Accepted Solution

    Note the line 17 that is throwing the error
        protected void Page_Load(object sender, EventArgs e);

    You see you have a ; and Page_Load method should look something like this:

    protected void Page_Load(object sender, EventArgs e)
      ///Your code goes here

    Author Closing Comment

    Thank you! I also found how to connect the code to the adapter (by properly coding the USING statement).

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now