![](/img/trans.png)
[英].NET Framework and Entity Framework Core: How can I get hold of the connection string
[英]how to get connection string in .net core to Azure SQL without Entity Framework?
I am currently created one Aspnet core C# web api search, which need connected to Azure SQL server.
任何人都知道我需要使用的連接字符串是什么?
我們有一些現有的存儲過程,並希望不使用 Entity Framework Core 直接調用它。
這是我的 Azure Data Studio 登錄信息。
這是我用來連接到 Azure SQL 的代碼
string connectionString = "Server=testServer.database.windows.net;Database=testDB; Authentication=Active Directory Integrated;";
using (SqlConnection sqlConnection = new SqlConnection(connectionString))
{
try
{
sqlConnection.Open();
}catch(Exception ex)
{
}
}
謝謝
經過幾個小時的測試,我發現了一個對我有用的連接字符串。
string connectionString = "Data Source=server.database.windows.net;Initial Catalog=dbname;User ID=abc@def.com;Password='testing password'; Authentication='Active Directory Password'";
希望這個可以幫助其他使用Azure Active Directory 的人 - Universal MFA Support
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.