L
Lance
I've been teaching myself C# for a few months now and I have a concept
problem. I know how to instantiate an object from a class I’ve created,
but now I want to retrieve and store data in a database and I can’t seem
to understand how I would name my objects.
For example, I have an employee’s database with all the info I want an
employee to have. I also have an employee class, that with methods can
open and retrieve an employee from the database and manipulate that data
and save it back to the database. Now this is where I have a conceptual
problem. When I was goofing around and learning this OOP language I
could type the following:
Employee fred = new Employee();
With this new object "fred" I could do all those things that an object
of Employee could do. Now I named this object "fred" in my code and
used it as needed. What I’m having a problem with is when the data is
in a database and a user wants to open the database and change something
how do you name the objects? Another words, how do I get data from the
database and use it as the name of my object? If the user opens more
than one employee at a time how do I name these Employee objects using
the database? Do I have to have different names for each object of
employee opened? Do I have to even use the database to name my objects.
This is a very confusing concept to me so pretend you’re talking to a
child and maybe I can understand this concept.
Thanks in advance.
Lance Alwood
(e-mail address removed)
problem. I know how to instantiate an object from a class I’ve created,
but now I want to retrieve and store data in a database and I can’t seem
to understand how I would name my objects.
For example, I have an employee’s database with all the info I want an
employee to have. I also have an employee class, that with methods can
open and retrieve an employee from the database and manipulate that data
and save it back to the database. Now this is where I have a conceptual
problem. When I was goofing around and learning this OOP language I
could type the following:
Employee fred = new Employee();
With this new object "fred" I could do all those things that an object
of Employee could do. Now I named this object "fred" in my code and
used it as needed. What I’m having a problem with is when the data is
in a database and a user wants to open the database and change something
how do you name the objects? Another words, how do I get data from the
database and use it as the name of my object? If the user opens more
than one employee at a time how do I name these Employee objects using
the database? Do I have to have different names for each object of
employee opened? Do I have to even use the database to name my objects.
This is a very confusing concept to me so pretend you’re talking to a
child and maybe I can understand this concept.
Thanks in advance.
Lance Alwood
(e-mail address removed)