Hi guys. I'm new to C# though I have programming experiences with other languages. My question seems too noobie but the true is that I was raised programming at low level. This high level things are new for me so... sorry if this is really easy.
What i'm trying to do is to pass some information from a data base via parameters to my class method. Here's my class:
So when I go to main, I can do something like this:Code:using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace Relationship_Management { public class Individual { private int id; private string name; private string lastName; private string existingRelation; private string microsoftFriendly; private string hasBudget; private string underRadar; private int reportTo; public int ID { get { return id; } set { id = value;} } public string Name { get { return name; } set { name = value; } } public string LastName { get { return lastName; } set { lastName = value; } } public string ExistingRelation { get { return existingRelation; } set { existingRelation = value; } } public string MicrosoftFriendly { get { return microsoftFriendly; } set { microsoftFriendly = value; } } public string HasBudget { get { return hasBudget; } set { hasBudget = value; } } public string UnderRadar { get { return underRadar; } set { underRadar = value; } } public int ReportTo { get { return reportTo; } set { reportTo = value; } } } }
Now, that number is suppose to be a random ID number that a DBMS generate automatically. My question is this... HOW IN THE WORLD can I do to pass fields of the data base or any info. of a table to my object fields? I mean something like this:Code:Individual person = new Individual(); person.ReportTo = 345;
Or there is a way via query to assing a data base value to a variable? I hope that I explained myself well enough and sorry about my english. Is not my main language. I will waiting for your answers people.Code:Individual person = new Individual(); // person.ReportTo = TableName.ID (data base info);
Many thanks



LinkBack URL
About LinkBacks


