Click here to Skip to main content
15,904,339 members
Home / Discussions / C#
   

C#

 
QuestionButterfly Flight Pin
DFlat4Now30-Jul-08 10:08
DFlat4Now30-Jul-08 10:08 
AnswerRe: Butterfly Flight Pin
Thomas Stockwell30-Jul-08 10:19
professionalThomas Stockwell30-Jul-08 10:19 
AnswerRe: Butterfly Flight Pin
jedliu204630-Jul-08 16:01
jedliu204630-Jul-08 16:01 
Questionstoring data Pin
damianrda30-Jul-08 7:40
damianrda30-Jul-08 7:40 
AnswerRe: storing data Pin
TheFM23430-Jul-08 8:03
TheFM23430-Jul-08 8:03 
AnswerRe: storing data Pin
led mike30-Jul-08 8:05
led mike30-Jul-08 8:05 
AnswerRe: storing data Pin
damianrda30-Jul-08 10:00
damianrda30-Jul-08 10:00 
GeneralRe: storing data [modified] Pin
Mark Salsbery30-Jul-08 11:30
Mark Salsbery30-Jul-08 11:30 
Questionown Printer service on c#.net Pin
balu1234530-Jul-08 7:30
balu1234530-Jul-08 7:30 
AnswerRe: own Printer service on c#.net Pin
vikas amin30-Jul-08 10:50
vikas amin30-Jul-08 10:50 
GeneralRe: own Printer service on c#.net Pin
vikas amin30-Jul-08 10:52
vikas amin30-Jul-08 10:52 
GeneralRe: own Printer service on c#.net Pin
balu1234530-Jul-08 23:31
balu1234530-Jul-08 23:31 
GeneralRe: own Printer service on c#.net Pin
vikas amin1-Aug-08 5:37
vikas amin1-Aug-08 5:37 
GeneralRe: own Printer service on c#.net Pin
vikas amin1-Aug-08 6:15
vikas amin1-Aug-08 6:15 
GeneralRe: own Printer service on c#.net Pin
vikas amin19-Aug-08 5:41
vikas amin19-Aug-08 5:41 
QuestionArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 6:30
zeeShan anSari30-Jul-08 6:30 
AnswerRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 6:44
mentorWendelius30-Jul-08 6:44 
GeneralRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 6:52
zeeShan anSari30-Jul-08 6:52 
QuestionRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 6:54
mentorWendelius30-Jul-08 6:54 
AnswerRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 7:09
zeeShan anSari30-Jul-08 7:09 
GeneralRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 7:22
mentorWendelius30-Jul-08 7:22 
GeneralRe: ArrayList ....Where is problem? Pin
Alaric_30-Jul-08 7:31
professionalAlaric_30-Jul-08 7:31 
Mika beat me to it.

Yeah....applying the static modifier to the properties in your class makes it so that the "Department" class will maintain a SINGLE value for all instances of that class.


if you remove "static" as Mika suggested, you should be able to restructure your code as such to provide the functionality you're requesting:
ArrayList departments= new ArrayList();
Dept department;
while(reader.Read)
{
  department = new Dept();
  department.DName = reader["DepartmentName"] //or whatever name you have given your column
  department.DEPTNO = reader["DepartmentNumber"] //or whatever
  //...
  departments.Add(department);
}


One suggestion, simply from a coding style perspective: Don't abbreviate things that don't need to be abbreviated(unless you have some unknown technical limitation) Your objects are obviously being used for storing Department data, so why is your class not called "Department" ?

Your "DName" property would more appropriately be called "DepartmentName", but then again, with your class already named "Department", why would you need to restate the owner of the name? With a property of "Name", your object interface would be cleaner

department.Name;


"I need build Skynet. Plz send code"

GeneralRe: ArrayList ....Where is problem? Pin
zeeShan anSari30-Jul-08 7:47
zeeShan anSari30-Jul-08 7:47 
GeneralRe: ArrayList ....Where is problem? Pin
Wendelius30-Jul-08 7:58
mentorWendelius30-Jul-08 7:58 
QuestionInvisible Form Labels [modified] Pin
#realJSOP30-Jul-08 6:12
professional#realJSOP30-Jul-08 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.