connection string name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Liu

    connection string name

    Hi,

    When i add a connection string FpConnStr from application setting UI in VS
    2008, it ends with sth. like:

    <connectionStri ngs>
    <clear />
    <add name="CapiInter viewer.Properti es.Settings.FpC onnStr"
    connectionStrin g="data source=PowerCap iData"
    providerName="S ystem.Data.SQLi te" />
    </connectionStrin gs>


    Because this config is also shared by other class library/projects for the
    same application/solution, I don't like the
    "CapiInterviewe r.Properties.Se ttings" part VS 2008 added for me, is there
    any way to avoid it without breaking code? For example, I also use VS 2008
    data design to add a DataSet file (*.xsd), who will uses this connection
    string.

    Thanks a lot!
    Ryan


  • Joe Fawcett

    #2
    Re: connection string name



    "Ryan Liu" <rliu@powercati .comwrote in message
    news:ej679#vvIH A.3384@TK2MSFTN GP03.phx.gbl...
    Hi,
    >
    When i add a connection string FpConnStr from application setting UI in
    VS 2008, it ends with sth. like:
    >
    <connectionStri ngs>
    <clear />
    <add name="CapiInter viewer.Properti es.Settings.FpC onnStr"
    connectionStrin g="data source=PowerCap iData"
    providerName="S ystem.Data.SQLi te" />
    </connectionStrin gs>
    >
    >
    Because this config is also shared by other class library/projects for the
    same application/solution, I don't like the
    "CapiInterviewe r.Properties.Se ttings" part VS 2008 added for me, is there
    any way to avoid it without breaking code? For example, I also use VS 2008
    data design to add a DataSet file (*.xsd), who will uses this connection
    string.
    >
    Thanks a lot!
    Ryan
    >
    Just change the name value before using the connection. When asked to choose
    a connection for a task later the new value will be used.
    If the config file is shared across apps then you may want to consider
    removing the clear element.

    --

    Joe Fawcett (MVP - XML)


    Comment

    • Ryan Liu

      #3
      But Design.setting. cs won't take it. Re: connection string name

      Thanks Joe, but ...

      "Joe Fawcett" <joefawcett@new sgroup.nospam>
      ??????:5BE60BED-190C-4C90-946A-2FFE429F1008@mi crosoft.com...
      >
      >
      "Ryan Liu" <rliu@powercati .comwrote in message
      news:ej679#vvIH A.3384@TK2MSFTN GP03.phx.gbl...
      >Hi,
      >>
      >When i add a connection string FpConnStr from application setting UI in
      >VS 2008, it ends with sth. like:
      >>
      ><connectionStr ings>
      > <clear />
      > <add name="CapiInter viewer.Properti es.Settings.FpC onnStr"
      >connectionStri ng="data source=PowerCap iData"
      > providerName="S ystem.Data.SQLi te" />
      > </connectionStrin gs>
      >>
      >>
      >Because this config is also shared by other class library/projects for
      >the same application/solution, I don't like the
      >"CapiInterview er.Properties.S ettings" part VS 2008 added for me, is there
      >any way to avoid it without breaking code? For example, I also use VS
      >2008 data design to add a DataSet file (*.xsd), who will uses this
      >connection string.
      >>
      >Thanks a lot!
      >Ryan
      >>
      Just change the name value before using the connection. When asked to
      choose a connection for a task later the new value will be used.
      If the config file is shared across apps then you may want to consider
      removing the clear element.
      >

      If I just change name, then Design.setting. cs won't work. Seems it always
      use short name to match "long" name in app.exe.config file.




      --
      >
      Joe Fawcett (MVP - XML)
      http://joe.fawcett.name

      Comment

      • Jeff Winn

        #4
        Re: connection string name

        The reason that is being stored that way is you probably used the designer
        to place a control on the form that needed a connection string, or you're
        using the Settings section of the project to manipulate your app.config
        file. If you don't want to have the name look like that, edit your
        app.config file within your project manually, and set the connection strings
        within your application when you need them.

        You won't have that point and click ability to add designer controls to your
        form, but i hate using those anyway. Also imo, DataSets tend to be overused
        when working with databases. Keep an eye on how much memory your application
        is using since that type stores all of the data in memory - depending on the
        size of your table they can get very large and start to slow your
        application down.

        "Joe Fawcett" <joefawcett@new sgroup.nospamwr ote in message
        news:5BE60BED-190C-4C90-946A-2FFE429F1008@mi crosoft.com...
        >
        >
        "Ryan Liu" <rliu@powercati .comwrote in message
        news:ej679#vvIH A.3384@TK2MSFTN GP03.phx.gbl...
        >Hi,
        >>
        >When i add a connection string FpConnStr from application setting UI in
        >VS 2008, it ends with sth. like:
        >>
        ><connectionStr ings>
        > <clear />
        > <add name="CapiInter viewer.Properti es.Settings.FpC onnStr"
        >connectionStri ng="data source=PowerCap iData"
        > providerName="S ystem.Data.SQLi te" />
        > </connectionStrin gs>
        >>
        >>
        >Because this config is also shared by other class library/projects for
        >the same application/solution, I don't like the
        >"CapiInterview er.Properties.S ettings" part VS 2008 added for me, is there
        >any way to avoid it without breaking code? For example, I also use VS
        >2008 data design to add a DataSet file (*.xsd), who will uses this
        >connection string.
        >>
        >Thanks a lot!
        >Ryan
        >>
        Just change the name value before using the connection. When asked to
        choose a connection for a task later the new value will be used.
        If the config file is shared across apps then you may want to consider
        removing the clear element.
        >
        --
        >
        Joe Fawcett (MVP - XML)
        http://joe.fawcett.name

        Comment

        Working...