Simple data type question. namespace name 'Address' could not befound?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • karen.homersham@gmail.com

    Simple data type question. namespace name 'Address' could not befound?

    Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp. I
    am having problems compiling the following:

    using System;
    using System.Collecti ons.Generic;
    using System.Text;

    namespace ECommerce.Commo n
    {
    public class Users
    {
    private int _addressid;
    private Address _address;

    public Address Address
    {
    get { return _address; }
    set { _address = value; }
    }

    public int AddressID
    {
    get { return _addressid; }
    set { _addressid = value; }
    }
    }
    }

    Address is not a built in datatype and has not been defined anywhere
    previously. The book doesn't mention anything about the Address field
    and I don't understand well enough to read between the lines.

    If someone could put me in the right direction, I would be greatly
    appreciative.

    Thanks in advanced
    Karen


  • Mr. Arnold

    #2
    Re: Simple data type question. namespace name 'Address' could not be found?


    <karen.homersha m@gmail.comwrot e in message
    news:14a919dd-502c-47bf-813c-fdcf5df2e81a@i3 6g2000prf.googl egroups.com...
    Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp. I
    am having problems compiling the following:
    >
    using System;
    using System.Collecti ons.Generic;
    using System.Text;
    >
    namespace ECommerce.Commo n
    {
    public class Users
    {
    private int _addressid;
    private Address _address;
    >
    public Address Address
    {
    get { return _address; }
    set { _address = value; }
    }
    >
    public int AddressID
    {
    get { return _addressid; }
    set { _addressid = value; }
    }
    }
    }
    >
    Address is not a built in datatype and has not been defined anywhere
    previously. The book doesn't mention anything about the Address field
    and I don't understand well enough to read between the lines.
    >
    If someone could put me in the right direction, I would be greatly
    appreciative.
    >
    Thanks in advanced
    No, Address is not a primitive type of of int, long, string, double, or
    decimal etc, etc.

    It's an obvious error in the declaration of the variable in the book, which
    happens all the time.

    I suspect that string _address is what is needed there.

    Comment

    • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

      #3
      Re: Simple data type question. namespace name 'Address' could notbe found?

      karen.homersham @gmail.com wrote:
      Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp. I
      am having problems compiling the following:
      >
      using System;
      using System.Collecti ons.Generic;
      using System.Text;
      >
      namespace ECommerce.Commo n
      {
      public class Users
      {
      private int _addressid;
      private Address _address;
      >
      public Address Address
      {
      get { return _address; }
      set { _address = value; }
      }
      >
      public int AddressID
      {
      get { return _addressid; }
      set { _addressid = value; }
      }
      }
      }
      >
      Address is not a built in datatype and has not been defined anywhere
      previously. The book doesn't mention anything about the Address field
      and I don't understand well enough to read between the lines.
      >
      If someone could put me in the right direction, I would be greatly
      appreciative.
      It is pure guesswork to try and say what the author intended.

      Maybe there should be an Address class and it is just not in the book,
      because it is not important for the point.

      Maybe the type should be string.

      BTW, I would be very surprised if this is the final version of the
      User class. It looks very weird to me. A user with only address id and
      address as attributes ?? (and why is address id not part of address ??)

      Arne

      Comment

      • karen.homersham@gmail.com

        #4
        Re: Simple data type question. namespace name 'Address' could not befound?

        On May 25, 2:37 am, Arne Vajhøj <a...@vajhoej.d kwrote:
        karen.homers... @gmail.com wrote:
        Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp.  I
        am having problems compiling the following:
        >
        using System;
        using System.Collecti ons.Generic;
        using System.Text;
        >
        namespace ECommerce.Commo n
        {
            public class Users
            {
                private int _addressid;
                private Address _address;
        >
                public Address Address
                {
                    get { return _address; }
                    set { _address = value; }
                }
        >
                public int AddressID
                {
                    get { return _addressid; }
                    set { _addressid = value; }
                }
           }
        }
        >
        Address is not a built in datatype and has not been defined anywhere
        previously.  The book doesn't mention anything about the Address field
        and I don't understand well enough to read between the lines.
        >
        If someone could put me in the right direction, I would be greatly
        appreciative.
        >
        It is pure guesswork to try and say what the author intended.
        >
        Maybe there should be an Address class and it is just not in the book,
        because it is not important for the point.
        >
        Maybe the type should be string.
        >
        BTW, I would be very surprised if this is the final version of the
        User class. It looks very weird to me. A user with only address id and
        address as attributes ?? (and why is address id not part of address ??)
        >
        Arne- Hide quoted text -
        >
        - Show quoted text -
        I adapted the code as a working example, here is original.

        using System;
        using System.Collecti ons.Generic;
        using System.Text;

        namespace LittleItalyVine yard.Common
        {
        public class EndUser
        {
        private int _enduserid;
        private int _endusertypeid;
        private string _firstname;
        private string _lastname;
        private Address _address;
        private int _addressid;
        private ContactInformat ion _contactinforma tion;
        private int _contactinforma tionid;
        private string _password;
        private bool _issubscribed;

        public EndUser()
        {
        _address = new Address();
        _contactinforma tion = new ContactInformat ion();
        }

        public int EndUserID
        {
        get { return _enduserid; }
        set { _enduserid = value; }
        }

        public int EndUserTypeID
        {
        get { return _endusertypeid; }
        set { _endusertypeid = value; }
        }

        public string FirstName
        {
        get { return _firstname; }
        set { _firstname = value; }
        }

        public string LastName
        {
        get { return _lastname; }
        set { _lastname = value; }
        }

        public Address Address
        {
        get { return _address; }
        set { _address = value; }
        }

        public int AddressID
        {
        get { return _addressid; }
        set { _addressid = value; }
        }

        public ContactInformat ion ContactInformat ion
        {
        get { return _contactinforma tion; }
        set { _contactinforma tion = value; }
        }

        public int ContactInformat ionID
        {
        get { return _contactinforma tionid; }
        set { _contactinforma tionid = value; }
        }

        public string Password
        {
        get { return _password; }
        set { _password = value; }
        }

        public bool IsSubscribed
        {
        get { return _issubscribed; }
        set { _issubscribed = value; }
        }
        }
        }


        From what I gather ContactInformat ion, Address and EndUserTypeID, are
        1 to many relationships. EnduserTypeID is only got 2 fields id and
        name. Address and ContactInformat ion have lots of fields. Was
        wondering if I would have to complete Data Access stuff before this
        would work?
        If I compile original code it works fine. I don't really want to go
        on any further if I don't uderstand this as I may get deeper into a
        hole.

        cheers

        Comment

        • karen.homersham@gmail.com

          #5
          Re: Simple data type question. namespace name 'Address' could not befound?

          Found the problem I had to complete the address class first. I was
          compiling as I went just to check to see if each class was right, but
          a bit too fast. I uderstand what is going on better though.

          Thanks guys

          Comment

          Working...