sql-server - 连接到 SQL Server(Postgresql 数据库):使用什么作为主机名?
问题描述
我正在尝试直接在 VS Code 中运行 SQL 查询,但我无法连接到数据库。我的问题是我不知道应该使用什么主机名。
当我尝试连接时,系统会提示我:
hostname\instance
或<server>.database.windows.net
ADO.NET 连接字符串
我尝试使用:
localhost:5432
但这不起作用。我错过了什么?
解决方案
在此处获取服务器名称: 单击此处
SqlConnection cnx = new SqlConnection(@"data source = Server__Name ; initial catalog = Database__Name; integrated security = true");
我希望它有帮助:))
推荐阅读
- android - 如何同步读取 Firebase 实时数据库值?
- node.js - 如何使用 SendGrid 将图像嵌入到 Node.js 中的 html 邮件
- google-maps - Agm 谷歌地图 - 如何将纬度和经度绑定到 HTML
- oauth-2.0 - 点击浏览器上的后退按钮后第二次登录时关联失败
- javascript - 在指定的时间内运行一个函数并停止
- c# - EF:当它们不为空时按2个字段排序
- php - 如何在 PHP 中突出显示 utf8 文本中的非 utf8 字符串?
- wordpress - 如何在 wordpress 中模拟检查元素结果?
- typescript - 在 TypeScript 中将字符串转换为枚举
- git - gpg:keyblock 资源 pubring.kbx 未找到,因为 repo 路径以 gnupg 主页为前缀