Click here to Skip to main content
15,917,005 members
Home / Discussions / C#
   

C#

 
GeneralAccessing a row of data Pin
brian5528-Apr-05 11:20
brian5528-Apr-05 11:20 
GeneralRe: Accessing a row of data Pin
brian5528-Apr-05 15:41
brian5528-Apr-05 15:41 
QuestionHow do u see content of a namespace?? Pin
Poikilos28-Apr-05 11:05
Poikilos28-Apr-05 11:05 
AnswerRe: How do u see content of a namespace?? Pin
Tom Larsen28-Apr-05 11:20
Tom Larsen28-Apr-05 11:20 
AnswerRe: How do u see content of a namespace?? Pin
Marc Clifton28-Apr-05 11:28
mvaMarc Clifton28-Apr-05 11:28 
GeneralReconnecting to a remote server using DCOM Pin
bob2k_0328-Apr-05 10:27
bob2k_0328-Apr-05 10:27 
GeneralRe: Reconnecting to a remote server using DCOM Pin
Maxim Alekseykin29-Apr-05 2:47
Maxim Alekseykin29-Apr-05 2:47 
GeneralRe: Reconnecting to a remote server using DCOM Pin
bob2k_0329-Apr-05 3:27
bob2k_0329-Apr-05 3:27 
Thank you for the suggestion and I apologize for not being clearer. I do use try/catch blocks. I am attempting to implement some retry logic to handle the occasional network glitch. The CreateObject() method in the code below wraps the Type.GetTypeFromProgID() and Activator.CreateInstance() calls. The CreateObject() method is also the method I call to intially create the remote object (crudq in this code).

What I do to create this problem is set a breakpoint on the crudq.DatabaseQuery call. When the breakpoint is reached (and the remote object crudq is successfully created), I unplug the network cable and hit F10 to execute the call. The crudq.DatabaseQuery() throws a RPC_S_CALL_FAILED COMException. I then plug the network cable back in then F10 through the code. Every call to CreateObject() throws a RPC_S_CALL_FAILED COMException when it calls Activator.CreateInstance().

Below is the code:
<br />
public void DatabaseQuery(string databaseName, int instance, Object input, Object filter, ref Object output, ref int result)<br />
{<br />
  bool retry = true;<br />
  int count = 0;<br />
  int r = 0;<br />
  Object o;<br />
  do<br />
  {<br />
    try<br />
    {<br />
      crudq.DatabaseQuery(databaseName, instance, timeout, input, filter, out o, out r);<br />
      retry = false;<br />
      result = r;<br />
      output = o;<br />
    }<br />
    catch(COMException c)<br />
    {<br />
      if (count < retryAttempts && (c.ErrorCode == RPC_S_CALL_FAILED || c.ErrorCode == RPC_S_SERVER_UNAVAILABLE))<br />
      {<br />
        x.Info("DatabaseQuery: Retry count: " + count.ToString() + ", Exception: " + c.Message);<br />
        Thread.Sleep(delayBetweenRetry);<br />
        <br />
        //Recreate COM object<br />
        Object obj;<br />
        try<br />
        {<br />
          CreateObject(progID, server, out obj);<br />
          crudq = (AMSLib.ICRUDQ)obj;<br />
        }<br />
        catch<br />
        {<br />
        }<br />
        ++count;<br />
      }<br />
      else<br />
      {<br />
        x.Error("DatabaseQuery: Exception caught: " + c.Message, c);<br />
        throw;<br />
      }<br />
    }<br />
    catch(Exception e)<br />
    {<br />
      x.Error("DatabaseQuery: Exception caught: " + e.Message, e);<br />
      throw;<br />
    }<br />
  }<br />
  while(retry);<br />
}<br />

Thank you,
Bob
GeneralClass for MP3 and WMA Pin
housefreak_sls28-Apr-05 10:17
housefreak_sls28-Apr-05 10:17 
GeneralRe: Class for MP3 and WMA Pin
Thoughthopper29-Apr-05 11:38
Thoughthopper29-Apr-05 11:38 
GeneralRemoving elements during iteration through a Dictionary Pin
johtib28-Apr-05 10:14
johtib28-Apr-05 10:14 
GeneralRe: Removing elements during iteration through a Dictionary Pin
Stefan Troschuetz28-Apr-05 10:57
Stefan Troschuetz28-Apr-05 10:57 
GeneralRe: Removing elements during iteration through a Dictionary Pin
johtib28-Apr-05 11:02
johtib28-Apr-05 11:02 
GeneralRe: Removing elements during iteration through a Dictionary Pin
Stefan Troschuetz28-Apr-05 11:13
Stefan Troschuetz28-Apr-05 11:13 
GeneralRe: Removing elements during iteration through a Dictionary Pin
johtib28-Apr-05 11:16
johtib28-Apr-05 11:16 
GeneralRe: Removing elements during iteration through a Dictionary Pin
Sebastian Schneider28-Apr-05 20:36
Sebastian Schneider28-Apr-05 20:36 
GeneralRe: Removing elements during iteration through a Dictionary Pin
johtib29-Apr-05 10:42
johtib29-Apr-05 10:42 
GeneralRe: Removing elements during iteration through a Dictionary Pin
mav.northwind28-Apr-05 20:23
mav.northwind28-Apr-05 20:23 
GeneralRe: Removing elements during iteration through a Dictionary Pin
johtib28-Apr-05 20:30
johtib28-Apr-05 20:30 
GeneralRe: Removing elements during iteration through a Dictionary Pin
mav.northwind28-Apr-05 21:14
mav.northwind28-Apr-05 21:14 
GeneralRe: Removing elements during iteration through a Dictionary Pin
johtib29-Apr-05 10:44
johtib29-Apr-05 10:44 
QuestionWhat is the right way to create inherited classes derived from System.Windows.Forms.TextBox? Pin
rudy.net28-Apr-05 8:37
rudy.net28-Apr-05 8:37 
AnswerRe: What is the right way to create inherited classes derived from System.Windows.Forms.TextBox? Pin
Fernando Soto28-Apr-05 17:37
Fernando Soto28-Apr-05 17:37 
GeneralRe: What is the right way to create inherited classes derived from System.Windows.Forms.TextBox? Pin
rudy.net29-Apr-05 4:38
rudy.net29-Apr-05 4:38 
GeneralMS SQL 2005 Express user Id and Password Pin
Jassim Rahma28-Apr-05 6:41
Jassim Rahma28-Apr-05 6:41 

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.