Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET ADO.NET
Hi everyone;
I am trying to do blog project and I am using ado.net and I have 3-tier architecture...
in one of classlibrary I have properties ... such as User and Comments
 
public class User
 {
     public int userID{ get; set; }
     public string userName{ get; set; }
     public string userPassword { get; set; }
     public string userMail{ get; set; }
}
 
public class Comments
{
    public int ID { get; set; }
    public int userID{ get; set; }
    public string commentHeader{ get; set; }
    public string commentContent{ get; set; }
}
 

I want use userName in Comments class.And I decided to create open property in Comment class.
Cause I will show in UI and I dont want to see just userID; better for understanding who sent this comment with userName...How I can create
 
    public string userName
    {
        get
        {
           return //(what I have to write here) 
        }
    }
Posted 24-Sep-12 20:34pm
y.baris676

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This is one possible option:
private string m_strUserName;
public string userName
{
  get
  {
    return m_strUserName;
  }
}
  Permalink  
Comments
y.baris at 25-Sep-12 7:50am
   
can you explain a little please...how can I reach information of user which I only know about his ID.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100