Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
QuestionHow to display numbers in different formats like exponential Pin
deepualuru20-Sep-06 0:33
deepualuru20-Sep-06 0:33 
AnswerRe: How to display numbers in different formats like exponential Pin
Christian Graus20-Sep-06 0:42
protectorChristian Graus20-Sep-06 0:42 
QuestionORCA Pin
MHASSANF20-Sep-06 0:23
MHASSANF20-Sep-06 0:23 
AnswerRe: ORCA Pin
Christian Graus20-Sep-06 0:26
protectorChristian Graus20-Sep-06 0:26 
QuestionUsing C#, how to compare table data from 2 different databases Pin
JPD20-Sep-06 0:08
JPD20-Sep-06 0:08 
AnswerRe: Using C#, how to compare table data from 2 different databases Pin
Christian Graus20-Sep-06 0:29
protectorChristian Graus20-Sep-06 0:29 
QuestionC# and IBM WebSphere MQ message borwsing Pin
How Gee19-Sep-06 23:51
How Gee19-Sep-06 23:51 
AnswerRe: C# and IBM WebSphere MQ message borwsing Pin
Gavin Jerman20-Sep-06 1:39
Gavin Jerman20-Sep-06 1:39 
Replace MQC.MQGMO_BROWSE_FIRST with MQC.MQGMO_BROWSE_NEXT and call Get in a loop until it fails - it will throw a harmless exception with a reason code of MQRC_NO_MSG_AVAILABLE when there are no more messages to browse.

I would also suggest that you use MQGMO_NO_WAIT rather than MQGMO_WAIT so that you don't have to wait until a message appears on the queue when you browse an empty queue.

Example code using home-brewed helper methods:

public bool browseMessages(out ArrayList messages, string queue)
    {
      // browse (i.e. get without removing) a message on the message queue
      messages = new ArrayList();
      MQQueueManager mqQM = null;
      MQQueue mqQ = null;

      try
      {
        if (queue == null || queue.Length == 0)
          throw new Exception("Queue name required");

        // connect to queue manager
        connectManager(out mqQM);

        // open queue with required access
        connectQueue(mqQM, queue, MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_BROWSE, out mqQ);

        // get message options
        MQGetMessageOptions mqGMO = new MQGetMessageOptions();
        mqGMO.Options = MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_NO_WAIT + MQC.MQGMO_BROWSE_NEXT; // browse with no wait
        mqGMO.MatchOptions = MQC.MQMO_NONE; // no matching required

        MQMessage mqMsg = new MQMessage(); // object to receive the message

        // browse all messages on the queue
        while (true)
        {
          // browse message - exception will be thrown when no more messages
          mqQ.Get(mqMsg, mqGMO);

          // get message text from the message object
          messages.Add(mqMsg.ReadString(mqMsg.MessageLength));
        }
      }
      catch (MQException mqex)
      {
        if (mqex.ReasonCode == MQC.MQRC_NO_MSG_AVAILABLE)
        {
          // harmless exception MQ throws to indicate that there are no messages on the queue
          return true;
        }
        else
          throwMQException(mqex);
      }
      finally
      {
        if (mqQ != null)
          mqQ.Close();

        if (mqQM != null)
          mqQM.Disconnect();
      }

      return false;
    }

Gavin
QuestionHow to add a seperator in windows context menu ? Pin
Waqas Nasir19-Sep-06 23:47
Waqas Nasir19-Sep-06 23:47 
Questiondoubt about onlayout Pin
kalaveer19-Sep-06 23:22
kalaveer19-Sep-06 23:22 
QuestionHow to get the last command line argument or argument without the delimiter Pin
zxc8919-Sep-06 23:16
zxc8919-Sep-06 23:16 
AnswerRe: How to get the last command line argument or argument without the delimiter Pin
Christian Graus19-Sep-06 23:27
protectorChristian Graus19-Sep-06 23:27 
GeneralRe: How to get the last command line argument or argument without the delimiter Pin
zxc8919-Sep-06 23:47
zxc8919-Sep-06 23:47 
GeneralRe: How to get the last command line argument or argument without the delimiter Pin
Christian Graus19-Sep-06 23:49
protectorChristian Graus19-Sep-06 23:49 
GeneralRe: How to get the last command line argument or argument without the delimiter Pin
zxc8919-Sep-06 23:58
zxc8919-Sep-06 23:58 
GeneralRe: How to get the last command line argument or argument without the delimiter Pin
Christian Graus20-Sep-06 0:05
protectorChristian Graus20-Sep-06 0:05 
QuestionStreamReader and special tag problem Pin
cecildt19-Sep-06 23:08
cecildt19-Sep-06 23:08 
AnswerRe: StreamReader and special tag problem Pin
Christian Graus19-Sep-06 23:15
protectorChristian Graus19-Sep-06 23:15 
GeneralRe: StreamReader and special tag problem Pin
cecildt19-Sep-06 23:21
cecildt19-Sep-06 23:21 
QuestionBit Fields Pin
Sabry190519-Sep-06 23:01
Sabry190519-Sep-06 23:01 
AnswerRe: Bit Fields Pin
Christian Graus19-Sep-06 23:19
protectorChristian Graus19-Sep-06 23:19 
QuestionSELECT * FROM DB WHERE aFIELD = Null Pin
Glen Harvy19-Sep-06 22:40
Glen Harvy19-Sep-06 22:40 
AnswerRe: SELECT * FROM DB WHERE aFIELD = Null Pin
Christian Graus19-Sep-06 22:44
protectorChristian Graus19-Sep-06 22:44 
GeneralRe: SELECT * FROM DB WHERE aFIELD = Null Pin
Glen Harvy19-Sep-06 23:34
Glen Harvy19-Sep-06 23:34 
GeneralRe: SELECT * FROM DB WHERE aFIELD = Null Pin
Christian Graus19-Sep-06 23:38
protectorChristian Graus19-Sep-06 23:38 

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.