首页 > 解决方案 > 如何在运行 SQL Server 的虚拟机上创建 connectionString 以将 ado.net c# 连接到

问题描述

我在连接到在虚拟机(virtualbox)上运行的 SQL Server 时遇到了一些困难。我在 C# 中使用 ADO.NET 通过连接字符串进行连接,但我没有成功。

我的app.config文件如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
    </startup>
    <connectionStrings>
        <add name="AP3"
         connectionString="Data Source=190.166.2.8,1433;Initial Catalog=AP3;
                           User Id=sa;Password=PasswOrd;"
         providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

我不知道我是不是做错了什么...

标签: c#sql-serverado.netconnect

解决方案


您似乎不允许使用 Sql Server 进行远程连接。请点击此链接了解更多详情


推荐阅读