[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Namespace issues creating DAL with C#

Posted on 2009-04-29
4
Medium Priority
?
883 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:NaumLitvin
  • 2
  • 2
4 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 24261823
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.


0
 

Author Comment

by:NaumLitvin
ID: 24262109
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
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 1000 total points
ID: 24262169
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
}
0
 

Author Closing Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 20 hours left to enroll

830 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