Type 'ConnectionStringData' is not defined.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?ZG1idXNv?=

    Type 'ConnectionStringData' is not defined.

    I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used the
    June 2005 Enterprise Library while I'm going to use the latest EntLib, 4.0 -
    May 2008.

    I copied the 2003 app to a new 2008 folder structure, recreated the
    app.config using the new 4.0 EntLib config tool, and referenced the 4.0
    Microsoft.Pract ices.Enterprise Library.Data.dl l file.

    The problem is there is a Function that has errors in it and I'm not sure
    how to fix these.

    Here are the lines of code and their respective errors:

    Dim authConnectStri ng As ConnectionStrin gData
    Error: Type 'ConnectionStri ngData' is not defined.

    authConnectStri ng =
    dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst anceName, "_CS"))
    Error: 'ConnectionStri ngs' is not a member of
    'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings' .

    authInstance = New InstanceData(Co mmon.Constants. AuthDbInstanceN ame)
    Error: Argument not specified for parameter 'sample' of 'Public Sub
    New(instanceNam e As String, sample As System.Diagnost ics.CounterSamp le)'.

    There are a few more. Please contact me and I'll send you the Function so
    you can take a look at it.

    --
    Thanks,
    Dave B.
  • Cor Ligthert[MVP]

    #2
    Re: Type 'ConnectionStri ngData' is not defined.

    dmbuso-

    Have a look at this one, which is a special VB method



    -Cor

    "dmbuso" <dmbuso1@commun ity.nospamschre ef in bericht
    news:E9CB37DC-6747-4928-B26B-56C52A5D1156@mi crosoft.com...
    I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used
    the
    June 2005 Enterprise Library while I'm going to use the latest EntLib,
    4.0 -
    May 2008.
    >
    I copied the 2003 app to a new 2008 folder structure, recreated the
    app.config using the new 4.0 EntLib config tool, and referenced the 4.0
    Microsoft.Pract ices.Enterprise Library.Data.dl l file.
    >
    The problem is there is a Function that has errors in it and I'm not sure
    how to fix these.
    >
    Here are the lines of code and their respective errors:
    >
    Dim authConnectStri ng As ConnectionStrin gData
    Error: Type 'ConnectionStri ngData' is not defined.
    >
    authConnectStri ng =
    dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst anceName,
    "_CS"))
    Error: 'ConnectionStri ngs' is not a member of
    'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings' .
    >
    authInstance = New InstanceData(Co mmon.Constants. AuthDbInstanceN ame)
    Error: Argument not specified for parameter 'sample' of 'Public Sub
    New(instanceNam e As String, sample As System.Diagnost ics.CounterSamp le)'.
    >
    There are a few more. Please contact me and I'll send you the Function so
    you can take a look at it.
    >
    --
    Thanks,
    Dave B.

    Comment

    • =?Utf-8?B?ZG1idXNv?=

      #3
      Re: Type 'ConnectionStri ngData' is not defined.

      Cor,

      Thanks for the article. I read it, but I don't think this is really the
      route I should go. I viewed the app.config with XML Notepad and I think what
      I need to do is to read the 'connectionStri ngs' node contained in the
      app.config.

      Here's what it looks like in XML Notepad:

      <connectionStri ngs>
      <add name="LocalAuth _CS" connectionStrin g="Server=.;Int egrated
      Security=True" providerName="S ystem.Data.SqlC lient"/>
      <add name="RAID_CS" connectionStrin g="Database=RAI D;Server=.;Inte grated
      Security=False; User ID=RaidApp;Pass word="";Connect Timeout=30"
      providerName="S ystem.Data.SqlC lient"/>
      <add name="RAIDAuth_ CS" connectionStrin g="Database=RAI D;Server=.;Inte grated
      Security=True" providerName="S ystem.Data.SqlC lient"/>
      </connectionStrin gs>

      Also and as a side note, I created the app.config with the EntLib 4.0 config
      tool.

      This function is giving me an error also. It is telling me that that
      GetConfiguratio n is not a member of Sytem.Configura tion.Configurat ionManager.
      I think this is where I need to read the connection strings.

      Private Shared Function ReadDBSettings( ) As DatabaseSetting s
      Return
      CType(Configura tionManager.Get Configuration(" dataConfigurati on"),
      DatabaseSetting s)
      End Function


      Here is my email: David.M.Busovic ki@usdoj.gov
      and Work Phone: (814) 532-4925
      --
      Dave B.


      "Cor Ligthert[MVP]" wrote:
      dmbuso-
      >
      Have a look at this one, which is a special VB method
      >

      >
      -Cor
      >
      "dmbuso" <dmbuso1@commun ity.nospamschre ef in bericht
      news:E9CB37DC-6747-4928-B26B-56C52A5D1156@mi crosoft.com...
      I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used
      the
      June 2005 Enterprise Library while I'm going to use the latest EntLib,
      4.0 -
      May 2008.

      I copied the 2003 app to a new 2008 folder structure, recreated the
      app.config using the new 4.0 EntLib config tool, and referenced the 4.0
      Microsoft.Pract ices.Enterprise Library.Data.dl l file.

      The problem is there is a Function that has errors in it and I'm not sure
      how to fix these.

      Here are the lines of code and their respective errors:

      Dim authConnectStri ng As ConnectionStrin gData
      Error: Type 'ConnectionStri ngData' is not defined.

      authConnectStri ng =
      dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst anceName,
      "_CS"))
      Error: 'ConnectionStri ngs' is not a member of
      'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings' .

      authInstance = New InstanceData(Co mmon.Constants. AuthDbInstanceN ame)
      Error: Argument not specified for parameter 'sample' of 'Public Sub
      New(instanceNam e As String, sample As System.Diagnost ics.CounterSamp le)'.

      There are a few more. Please contact me and I'll send you the Function so
      you can take a look at it.

      --
      Thanks,
      Dave B.
      >
      >

      Comment

      • Steven Cheng [MSFT]

        #4
        RE: Type 'ConnectionStri ngData' is not defined.

        Hi Dave,

        Since the project is converted from VS 2003 to VS 2008 and it has changed
        much from .NET framework 1.1 to 2.0(or 3.5), especially for the
        configuration management architecture, it is possible that many such
        configuration related code will get broken.

        As for the code snippet you provided:

        =============== ====
        >authConnectStr ing =
        >dbSettings.Con nectionStrings. Item(String.Con cat(Common.Cons tants.AuthDbIns t
        anceName, "_CS"))
        >Error: 'ConnectionStri ngs' is not a member of
        >'Microsoft.Pra ctices.Enterpri seLibrary.Data. Configuration.D atabaseSettings '

        Comment

        • =?Utf-8?B?ZG1idXNv?=

          #5
          RE: Type 'ConnectionStri ngData' is not defined.

          Huh?

          PS - I'm using framework 3.5 also.
          --
          Dave B.


          "Steven Cheng [MSFT]" wrote:
          Hi Dave,
          >
          Since the project is converted from VS 2003 to VS 2008 and it has changed
          much from .NET framework 1.1 to 2.0(or 3.5), especially for the
          configuration management architecture, it is possible that many such
          configuration related code will get broken.
          >
          As for the code snippet you provided:
          >
          =============== ====
          authConnectStri ng =
          dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst
          anceName, "_CS"))
          Error: 'ConnectionStri ngs' is not a member of
          'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings'
          >

          Comment

          • Steven Cheng [MSFT]

            #6
            RE: Type 'ConnectionStri ngData' is not defined.

            Thanks for your reply Dave,

            Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
            your original code is coupled with .NET framework 1.1, the framework and
            enterprise library for that framework has changed much. Therefore, I
            suggeset you check any of those classes which is no longer used in the new
            framework or new enterprise library and replace them with the new syntax or
            code style. Have you tried changing the database accessing code as I
            mentioned in previous message to see whether the error disappears?

            Sincerely,

            Steven Cheng

            Microsoft MSDN Online Support Lead


            Delighting our customers is our #1 priority. We welcome your comments and
            suggestions about how we can improve the support we provide to you. Please
            feel free to let my manager know what you think of the level of service
            provided. You can send feedback directly to my manager at:
            msdnmg@microsof t.com.

            =============== =============== =============== =====
            Get notification to my posts through email? Please refer to
            Gain technical skills through documentation and training, earn certifications and connect with the community

            ications.

            =============== =============== =============== =====
            This posting is provided "AS IS" with no warranties, and confers no rights.
            --------------------
            >From: =?Utf-8?B?ZG1idXNv?= <dmbuso1@commun ity.nospam>
            >References: <E9CB37DC-6747-4928-B26B-56C52A5D1156@mi crosoft.com>
            <nFXmVqy2IHA.36 84@TK2MSFTNGHUB 02.phx.gbl>
            >Subject: RE: Type 'ConnectionStri ngData' is not defined.
            >Date: Tue, 1 Jul 2008 05:09:03 -0700
            >
            >Huh?
            >
            >PS - I'm using framework 3.5 also.
            >--
            >Dave B.
            >
            >
            >"Steven Cheng [MSFT]" wrote:
            >
            >Hi Dave,
            >>
            >Since the project is converted from VS 2003 to VS 2008 and it has
            changed
            >much from .NET framework 1.1 to 2.0(or 3.5), especially for the
            >configuratio n management architecture, it is possible that many such
            >configuratio n related code will get broken.
            >>
            >As for the code snippet you provided:
            >>
            >============== =====
            >authConnectStr ing =
            >>
            >dbSettings.Con nectionStrings. Item(String.Con cat(Common.Cons tants.AuthDbIns t
            >anceName, "_CS"))
            >Error: 'ConnectionStri ngs' is not a member of
            >>
            >'Microsoft.Pra ctices.Enterpri seLibrary.Data. Configuration.D atabaseSettings '
            >>
            >

            Comment

            • =?Utf-8?B?ZG1idXNv?=

              #7
              RE: Type 'ConnectionStri ngData' is not defined.

              Steven,

              No I haven't tried your supposed code change because your response is the
              same as what I had. Could you please repost it?

              Here is the line of code and the error it yields:

              authConnectStri ng =
              dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst anceName, "_CS"))

              Error: 'ConnectionStri ngs' is not a member of
              'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings' .

              --
              Dave B.


              "Steven Cheng [MSFT]" wrote:
              Thanks for your reply Dave,
              >
              Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
              your original code is coupled with .NET framework 1.1, the framework and
              enterprise library for that framework has changed much. Therefore, I
              suggeset you check any of those classes which is no longer used in the new
              framework or new enterprise library and replace them with the new syntax or
              code style. Have you tried changing the database accessing code as I
              mentioned in previous message to see whether the error disappears?
              >
              Sincerely,
              >
              Steven Cheng
              >
              Microsoft MSDN Online Support Lead
              >
              >
              Delighting our customers is our #1 priority. We welcome your comments and
              suggestions about how we can improve the support we provide to you. Please
              feel free to let my manager know what you think of the level of service
              provided. You can send feedback directly to my manager at:
              msdnmg@microsof t.com.
              >
              =============== =============== =============== =====
              Get notification to my posts through email? Please refer to
              Gain technical skills through documentation and training, earn certifications and connect with the community

              ications.
              >
              =============== =============== =============== =====
              This posting is provided "AS IS" with no warranties, and confers no rights.
              --------------------
              >
              From: =?Utf-8?B?ZG1idXNv?= <dmbuso1@commun ity.nospam>
              References: <E9CB37DC-6747-4928-B26B-56C52A5D1156@mi crosoft.com>
              <nFXmVqy2IHA.36 84@TK2MSFTNGHUB 02.phx.gbl>
              Subject: RE: Type 'ConnectionStri ngData' is not defined.
              Date: Tue, 1 Jul 2008 05:09:03 -0700
              >

              Huh?

              PS - I'm using framework 3.5 also.
              --
              Dave B.


              "Steven Cheng [MSFT]" wrote:
              Hi Dave,
              >
              Since the project is converted from VS 2003 to VS 2008 and it has
              changed
              much from .NET framework 1.1 to 2.0(or 3.5), especially for the
              configuration management architecture, it is possible that many such
              configuration related code will get broken.
              >
              As for the code snippet you provided:
              >
              =============== ====
              authConnectStri ng =
              >
              dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst
              anceName, "_CS"))
              Error: 'ConnectionStri ngs' is not a member of
              >
              'Microsoft.Prac tices.Enterpris eLibrary.Data.C onfiguration.Da tabaseSettings'
              >
              >
              >

              Comment

              • Steven Cheng [MSFT]

                #8
                RE: Type 'ConnectionStri ngData' is not defined.

                Thanks for your reply Dave,

                Oh, my omit. I just found that my first reply got truncated due to some
                tool issue. I'll compose a new one and post here soon. Really sorry for the
                misleading and inconvenience.

                Sincerely,

                Steven Cheng

                Microsoft MSDN Online Support Lead


                Delighting our customers is our #1 priority. We welcome your comments and
                suggestions about how we can improve the support we provide to you. Please
                feel free to let my manager know what you think of the level of service
                provided. You can send feedback directly to my manager at:
                msdnmg@microsof t.com.

                =============== =============== =============== =====
                Get notification to my posts through email? Please refer to
                Gain technical skills through documentation and training, earn certifications and connect with the community

                ications.

                =============== =============== =============== =====
                This posting is provided "AS IS" with no warranties, and confers no rights.
                --------------------
                >From: =?Utf-8?B?ZG1idXNv?= <dmbuso1@commun ity.nospam>
                >References: <E9CB37DC-6747-4928-B26B-56C52A5D1156@mi crosoft.com>
                <nFXmVqy2IHA.36 84@TK2MSFTNGHUB 02.phx.gbl>
                <4C68D9D5-6F2C-4E56-85EB-CA5C79312926@mi crosoft.com>
                <iEYI7rA3IHA.16 24@TK2MSFTNGHUB 02.phx.gbl>
                >Subject: RE: Type 'ConnectionStri ngData' is not defined.
                >Date: Wed, 2 Jul 2008 05:06:01 -0700
                >Steven,
                >
                >No I haven't tried your supposed code change because your response is the
                >same as what I had. Could you please repost it?
                >
                >Here is the line of code and the error it yields:
                >
                >authConnectStr ing =
                dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst a
                nceName, "_CS"))
                >
                >Error: 'ConnectionStri ngs' is not a member of
                >'Microsoft.Pra ctices.Enterpri seLibrary.Data. Configuration.D atabaseSettings '

                Comment

                • Steven Cheng [MSFT]

                  #9
                  RE: Type 'ConnectionStri ngData' is not defined.

                  Hi Dave,

                  In my first reply, I mentioned some suggestion about the two problems you
                  said in your initial messsage.

                  1. About the ConnectionStrin gData. It is apparently that, from .net
                  framework 2.0, this class type will not be used (also for the new
                  enterprise library). And since .net framework 2.0 application's app.config
                  file has built-in connection string support, the entlib will also utlize
                  it. The typical code that establish database connection and perform command
                  operation is like below:

                  =============== ==========


                  Public Function UpdateProducts( ) As Integer
                  ' Create the Database object, using the default database service.
                  The
                  ' default database service is determined through configuration.
                  Dim db As Database = DatabaseFactory .CreateDatabase ()

                  Dim productsDataSet As DataSet = New DataSet

                  Dim sqlCommand As String = "Select ProductID, ProductName,
                  CategoryID, UnitPrice, LastUpdate " & _
                  "From Products"
                  Dim dbCommand As DbCommand = db.GetSqlString Command(sqlComm and)

                  ............... ..........

                  =============== ==========

                  it use a DatabaseFactory to direclty get a DataBase object(the default one
                  or you can supply a name).

                  And for the ConfigurationMa nager class, it doesn't have a
                  "GetConfigurati on" method, only a "GetSection " method is available. You can
                  refer to the available member list of ConfigurationMa nager class:

                  #ConfigurationM anager Members
                  Gain technical skills through documentation and training, earn certifications and connect with the community

                  nager_members.a spx

                  Also, I think you can refer to some of the samples in the enterprise
                  library 4.0(such as the data access ones) and convert those old style
                  code(in entlib 1.1) to the new style ones.

                  Sincerely,

                  Steven Cheng

                  Microsoft MSDN Online Support Lead


                  Delighting our customers is our #1 priority. We welcome your comments and
                  suggestions about how we can improve the support we provide to you. Please
                  feel free to let my manager know what you think of the level of service
                  provided. You can send feedback directly to my manager at:
                  msdnmg@microsof t.com.

                  =============== =============== =============== =====
                  Get notification to my posts through email? Please refer to
                  Gain technical skills through documentation and training, earn certifications and connect with the community

                  ications.

                  Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
                  where an initial response from the community or a Microsoft Support
                  Engineer within 1 business day is acceptable. Please note that each follow
                  up response may take approximately 2 business days as the support
                  professional working with you may need further investigation to reach the
                  most efficient resolution. The offering is not appropriate for situations
                  that require urgent, real-time or phone-based interactions or complex
                  project analysis and dump analysis issues. Issues of this nature are best
                  handled working with a dedicated Microsoft Support Engineer by contacting
                  Microsoft Customer Support Services (CSS) at
                  http://msdn.microsoft.com/subscripti...t/default.aspx.
                  =============== =============== =============== =====
                  This posting is provided "AS IS" with no warranties, and confers no rights.
                  --------------------
                  >Subject: RE: Type 'ConnectionStri ngData' is not defined.
                  >Date: Wed, 2 Jul 2008 05:06:01 -0700
                  >Steven,
                  >
                  >No I haven't tried your supposed code change because your response is the
                  >same as what I had. Could you please repost it?
                  >
                  >Here is the line of code and the error it yields:
                  >
                  >authConnectStr ing =
                  dbSettings.Conn ectionStrings.I tem(String.Conc at(Common.Const ants.AuthDbInst a
                  nceName, "_CS"))
                  >
                  >Error: 'ConnectionStri ngs' is not a member of
                  >'Microsoft.Pra ctices.Enterpri seLibrary.Data. Configuration.D atabaseSettings '
                  ..
                  >
                  >--
                  >Dave B.
                  >
                  >
                  >"Steven Cheng [MSFT]" wrote:
                  >
                  >Thanks for your reply Dave,
                  >>
                  >Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
                  >your original code is coupled with .NET framework 1.1, the framework and
                  >enterprise library for that framework has changed much. Therefore, I
                  >suggeset you check any of those classes which is no longer used in the
                  new
                  >framework or new enterprise library and replace them with the new syntax
                  or
                  >code style. Have you tried changing the database accessing code as I
                  >mentioned in previous message to see whether the error disappears?
                  >>
                  >Sincerely,
                  >>
                  >Steven Cheng
                  >>
                  >Microsoft MSDN Online Support Lead
                  >>
                  >>
                  >Delighting our customers is our #1 priority. We welcome your comments
                  and
                  >suggestions about how we can improve the support we provide to you.
                  Please
                  >feel free to let my manager know what you think of the level of service
                  >provided. You can send feedback directly to my manager at:
                  >msdnmg@microsof t.com.
                  >>

                  Comment

                  Working...