Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Could not get the ConnectionString from Registry Key

Could not get the ConnectionString from Registry Key

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminhelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10860215
    wrote on last edited by
    #1

    I have given the value for the connetionstring and TeamsConnectionString in registry settings but s still i am facing the following error. can anyone please suggest me to resolve this error Error details from event details: --------------------------------- The following information was included with the event: Could not get the ConnectionString from Registry Key =SOFTWARE\Kimberly-Clark\Knowledge Management; Value = TeamsConnectionString Last error number: 0

    L 1 Reply Last reply
    0
    • U User 10860215

      I have given the value for the connetionstring and TeamsConnectionString in registry settings but s still i am facing the following error. can anyone please suggest me to resolve this error Error details from event details: --------------------------------- The following information was included with the event: Could not get the ConnectionString from Registry Key =SOFTWARE\Kimberly-Clark\Knowledge Management; Value = TeamsConnectionString Last error number: 0

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to show the code you are using to get the key, and the exact error message or return code.

      U 1 Reply Last reply
      0
      • L Lost User

        You need to show the code you are using to get the key, and the exact error message or return code.

        U Offline
        U Offline
        User 10860215
        wrote on last edited by
        #3

        lfLog.DebugMsgStart(" Retrieving Connection String");

        csKey = "SOFTWARE\\Kimberly-Clark\\Knowledge Management";
        if ( !rReg.GetSZValue(HKEY_LOCAL_MACHINE,csKey, csConnectionStringReference, csConnectionString))
        {
        // could not get program name
        lfLog.DebugMsgEnd("FAILED");
        csMsg.Format("Could not get the ConnectionString from Registry Key = '%s', Value = '%s'", csKey, csConnectionStringReference);
        elLog.ErrorMsg(csMsg);
        lfLog.ErrorMsg(csMsg);

          // log the message code
          mclLog.ErrorMsg( 0, "ConnectionString");
          goto exit30;
        

        }
        lfLog.DebugMsgEnd("SUCCESS");

        and i am having the values in registry under the path mentioned in the code

        L D 2 Replies Last reply
        0
        • U User 10860215

          lfLog.DebugMsgStart(" Retrieving Connection String");

          csKey = "SOFTWARE\\Kimberly-Clark\\Knowledge Management";
          if ( !rReg.GetSZValue(HKEY_LOCAL_MACHINE,csKey, csConnectionStringReference, csConnectionString))
          {
          // could not get program name
          lfLog.DebugMsgEnd("FAILED");
          csMsg.Format("Could not get the ConnectionString from Registry Key = '%s', Value = '%s'", csKey, csConnectionStringReference);
          elLog.ErrorMsg(csMsg);
          lfLog.ErrorMsg(csMsg);

            // log the message code
            mclLog.ErrorMsg( 0, "ConnectionString");
            goto exit30;
          

          }
          lfLog.DebugMsgEnd("SUCCESS");

          and i am having the values in registry under the path mentioned in the code

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Very interesting, but what is happening when you run this code? What does rReg.GetSZValue return and where is the class definition for it? What is contained in csConnectionStringReference and csConnectionString? What system calls are being used and if they fail what is returned by GetLastError()?

          U 1 Reply Last reply
          0
          • L Lost User

            Very interesting, but what is happening when you run this code? What does rReg.GetSZValue return and where is the class definition for it? What is contained in csConnectionStringReference and csConnectionString? What system calls are being used and if they fail what is returned by GetLastError()?

            U Offline
            U Offline
            User 10860215
            wrote on last edited by
            #5

            code compilation is success an now i am trying to install and run the service in the production server . rReg.GetSZValue success if it successfully fetch the value from regtry path or else failed ,now it is returning fail in log . csConnectionStringReference contained the key name "TeamsConncetionstring" and this value is also ftched from the registry itself. csConnectionString should be stored with the value of the key "TeamsConncetionstring". GetLastError() returning 0 here . And if any error even will log with the error details which i have reported earlier.

            L 1 Reply Last reply
            0
            • U User 10860215

              code compilation is success an now i am trying to install and run the service in the production server . rReg.GetSZValue success if it successfully fetch the value from regtry path or else failed ,now it is returning fail in log . csConnectionStringReference contained the key name "TeamsConncetionstring" and this value is also ftched from the registry itself. csConnectionString should be stored with the value of the key "TeamsConncetionstring". GetLastError() returning 0 here . And if any error even will log with the error details which i have reported earlier.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I'm sorry but that tells us nothing about what is happening. You need to use your debugger to step through the code and see the exact status values that you are receiving when you try to read this value from the registry. You still have not shown the code that does to do the actual call to get the value from the registry, only rReg.GetSZValue.

              1 Reply Last reply
              0
              • U User 10860215

                lfLog.DebugMsgStart(" Retrieving Connection String");

                csKey = "SOFTWARE\\Kimberly-Clark\\Knowledge Management";
                if ( !rReg.GetSZValue(HKEY_LOCAL_MACHINE,csKey, csConnectionStringReference, csConnectionString))
                {
                // could not get program name
                lfLog.DebugMsgEnd("FAILED");
                csMsg.Format("Could not get the ConnectionString from Registry Key = '%s', Value = '%s'", csKey, csConnectionStringReference);
                elLog.ErrorMsg(csMsg);
                lfLog.ErrorMsg(csMsg);

                  // log the message code
                  mclLog.ErrorMsg( 0, "ConnectionString");
                  goto exit30;
                

                }
                lfLog.DebugMsgEnd("SUCCESS");

                and i am having the values in registry under the path mentioned in the code

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                What type of object is rReg?

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups