中の技術日誌ブログ

C#とC++/CLIと
VBと.NETとWindowsで戯れる
 

目次

Blog 利用状況

ニュース

自己紹介

東京でソフトウェアエンジニアをやっています。
お仕事大募集中です。
記事執筆や、講師依頼とかでも何でもどうぞ(*^_^*)
似顔絵 MSMVPロゴ
MSMVP Visual C# Since 2004/04-2013/03

記事カテゴリ

書庫

日記カテゴリ

00-整理

01-MSMVP

connectionStrings Element

http://msdn2.microsoft.com/en-us/library/bf7sd233(en-US,VS.80).aspx

.NET 2.0からは通常のSettingsという概念が入っています。

その概念はちょっとややこしいので、脇へおいておきますが、.configファイルにconnectionStringsという要素が追加されます。

  <add name="Library.Properties.Settings.dataConnectionString"
            connectionString="Data Source=(local);Initial Catalog=data;user=login;password=pass"
            providerName="System.Data.SqlClient" />

このように設定します。

そうすると明示的に接続文字列とわかるようになります。

ただしこの接続文字列ですが、テスト環境と、本番環境では違うことがほとんどだと思います。

以前このような接続文字列はappSettingsに作成し利用していました。

<appSettings file="user.config">
  <add key="ConnectionString" value="Data Source=(local);Initial Catalog=data;user=login;password=pass" />
</appSettings>

このようにappSettings要素の場合に設定を上書きするfileという属性がありuser.configファイルで

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="ConnectionString" value="Data Source=(local)\test;Initial Catalog=data;user=login;password=pass" />
</appSettings>

と設定しておけばOKでした。

さて.NET2.0ではこの場合どうしたらいいのでしょうか

#オチナシ orz

投稿日時 : 2005年11月6日 14:14

コメントを追加

# OWpcJYlJXZD 2011/09/28 9:53 http://oemfinder.com

W6WLmB Heartfelt thanks..!

# kOTazpERUJUk 2011/11/02 5:23 http://www.pharmaciecambier.com/

The Author is crazy..!

# OAftXenoAZrvIE 2011/11/02 6:17 http://optclinic.com/

Comrade kill yourself.

# MnXdZfHVUYSPAEIhoS 2011/11/02 8:37 http://travelimagehosting.com/

I would add something else, of course, but in fact almost everything is mentioned!...

# FSofIjvUlISYx 2011/11/16 3:54 http://www.laurenslinens.com/satinsheet.html

Hooray! the one who wrote is a cool guy..!

# cqyJZEzXXRd 2011/11/16 4:38 http://www.hooksandlattice.com/wall-mount-brackets

It's pleasant sitting at work to distract from it?to relax and read the information written here:D

# HagTNdUHFWfsfG 2011/12/17 19:36 http://www.neojogos.com

Every time I come back here again and don`t get disappointed..!

タイトル
名前
URL
コメント