3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

asp.netのDB接続文字列の場所とコネクション取得方法

Posted at

sql serverへ接続してる場合

Web.config
<connectionStrings>
    <add name="hoge" providerName="System.Data.SqlClient" connectionString="hogeDB"/>
</connectionStrings>

Using使わないでconnection取ってくる

dbConnection.cs

SqlConnection conn = new SqlConnection();
conn.ConnectionString = @"hogeDB";
conn.Open()
conn.Close();

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?