471,596 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

connection string name

Hi,

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

<connectionStrings>
<clear />
<add name="CapiInterviewer.Properties.Settings.FpConnSt r"
connectionString="data source=PowerCapiData"
providerName="System.Data.SQLite" />
</connectionStrings>
Because this config is also shared by other class library/projects for the
same application/solution, I don't like the
"CapiInterviewer.Properties.Settings" 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
Jun 27 '08 #1
3 2362


"Ryan Liu" <rl**@powercati.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...
Hi,

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

<connectionStrings>
<clear />
<add name="CapiInterviewer.Properties.Settings.FpConnSt r"
connectionString="data source=PowerCapiData"
providerName="System.Data.SQLite" />
</connectionStrings>
Because this config is also shared by other class library/projects for the
same application/solution, I don't like the
"CapiInterviewer.Properties.Settings" 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

Jun 27 '08 #2
Thanks Joe, but ...

"Joe Fawcett" <jo********@newsgroup.nospam>
??????:5B**********************************@micros oft.com...
>

"Ryan Liu" <rl**@powercati.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...
>Hi,

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

<connectionStrings>
<clear />
<add name="CapiInterviewer.Properties.Settings.FpConnSt r"
connectionString="data source=PowerCapiData"
providerName="System.Data.SQLite" />
</connectionStrings>
Because this config is also shared by other class library/projects for
the same application/solution, I don't like the
"CapiInterviewer.Properties.Settings" 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

Jun 27 '08 #3
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" <jo********@newsgroup.nospamwrote in message
news:5B**********************************@microsof t.com...
>

"Ryan Liu" <rl**@powercati.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...
>Hi,

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

<connectionStrings>
<clear />
<add name="CapiInterviewer.Properties.Settings.FpConnSt r"
connectionString="data source=PowerCapiData"
providerName="System.Data.SQLite" />
</connectionStrings>
Because this config is also shared by other class library/projects for
the same application/solution, I don't like the
"CapiInterviewer.Properties.Settings" 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
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Paul Robinson | last post: by
reply views Thread by JWM | last post: by
37 posts views Thread by sam44 | last post: by
13 posts views Thread by Jennifer.Berube | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.