472,960 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

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.Collections.Generic;
using System.Text;

namespace ECommerce.Common
{
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
Jun 27 '08 #1
4 1652

<ka*************@gmail.comwrote in message
news:14**********************************@i36g2000 prf.googlegroups.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.Collections.Generic;
using System.Text;

namespace ECommerce.Common
{
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.

Jun 27 '08 #2
ka*************@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.Collections.Generic;
using System.Text;

namespace ECommerce.Common
{
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

Jun 27 '08 #3
On May 25, 2:37*am, Arne Vajhøj <a...@vajhoej.dkwrote:
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.Collections.Generic;
using System.Text;
namespace ECommerce.Common
{
* * 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.Collections.Generic;
using System.Text;

namespace LittleItalyVineyard.Common
{
public class EndUser
{
private int _enduserid;
private int _endusertypeid;
private string _firstname;
private string _lastname;
private Address _address;
private int _addressid;
private ContactInformation _contactinformation;
private int _contactinformationid;
private string _password;
private bool _issubscribed;

public EndUser()
{
_address = new Address();
_contactinformation = new ContactInformation();
}

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 ContactInformation ContactInformation
{
get { return _contactinformation; }
set { _contactinformation = value; }
}

public int ContactInformationID
{
get { return _contactinformationid; }
set { _contactinformationid = value; }
}

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

public bool IsSubscribed
{
get { return _issubscribed; }
set { _issubscribed = value; }
}
}
}
From what I gather ContactInformation, Address and EndUserTypeID, are
1 to many relationships. EnduserTypeID is only got 2 fields id and
name. Address and ContactInformation 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
Jun 27 '08 #4
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
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dariusz | last post by:
I am a beginner in PHP and MySQL, and am working through a book and various online tutorials on PHP and MySQL and now stuck - installed everything on "localhost" and it all works fine. My question...
0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
7
by: Mark Prenter | last post by:
Hi all, I'm fairly new to .NET and I haven't done much in C++ before, nothing complex anyway, but I have a pretty good understanding of programming in general. What I'm trying to do is create a...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
1
by: robinsand | last post by:
I am a new C++ programmer. I am still having trouble with certain data types and constructors, among other things. I'm not sure if I've used "std::string" properly throughout this program. I need...
1
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
Hi, I have been given a set of xsd files which I need to use to generate XML files with my data added. I am using the DataSet.ReadXmlSchema() but get the error: ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.