Home > Net >  For help, SQL database and the queue queue
For help, SQL database and the queue queue

Time:09-25

The SQL database read data on an object, and then put the object in the queue queue, why can only display the last object data?

CodePudding user response:

You don't also know reference type?

CodePudding user response:

You put the same object in two, you want to get two different objects, is there such a thing?

CodePudding user response:

With the SQL with queue also do not have what relation.

Reference... Baidu it..

CodePudding user response:

You are on the same object assignment twice! As reference so they point to address is the same, so you are added to the queue in the same object, your output will always be the last change of The Times the value of the

QueueInfo queueInfo01=new queueInfo.
Listqueue. The Enqueue (queueInfo01);
QueueInfo queueInfo02=new queueInfo.
Listqueue. The Enqueue (queueInfo02);

Need New New object every time! To go there will be no problem!

CodePudding user response:

reference 4 floor xinbada1985 response:
you twice on the same object assignment! As reference so they point to address is the same, so you are added to the queue in the same object, your output will always be the last change of The Times the value of the

QueueInfo queueInfo01=new queueInfo.
Listqueue. The Enqueue (queueInfo01);
QueueInfo queueInfo02=new queueInfo.
Listqueue. The Enqueue (queueInfo02);

Need New New object every time! To go there will be no problem!

Thank you, has been solved
  •  Tags:  
  • C#
  • Related