如何在 C# 中为 Adaptive Server Anywhere 网络服务器设置 ODBC 连接字符串

发布于 2024-08-04 07:14:27 字数 105 浏览 6 评论 0原文

我有一个自适应服务器任何地方网络服务器(版本7.0),它的名称是“TestServer”。 现在,客户端想要使用 DOTNET 中的 OdbcConnetion 连接该服务器,如何设置连接字符串?

I have a adaptive server anywhere network server(version 7.0),it's name is "TestServer".
Now, Client want to connect this server using OdbcConnetion in DOTNET,How to set the connection string ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个少女永远怀春 2024-08-11 07:14:27

ODBC 使用 DSN 的连接字符串如下所示:

string connString = "DSN=TestServer;UID=user;PWD=password;";

使用 DSN 要求客户端在客户端计算机上设置 ODBC DSN。
或者,如果您知道用户安装了哪个 ODBC 驱动程序,则可以在连接字符串中包含驱动程序详细信息:

string connString = "{Microsoft ODBC for Oracle};SERVER=TestServer;UID=user;PWD=password;";

然后在创建 OdbcConnection 对象时包含连接字符串:

System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(connString);

或者之后:

System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
conn.ConnectionString = connString;

The connection string for ODBC use DSN like this:

string connString = "DSN=TestServer;UID=user;PWD=password;";

Using DSN requires the client to set up the ODBC DSN on the client computer.
Alternatively, you can include the driver details in the connection string if you know what ODBC driver the user has installed:

string connString = "{Microsoft ODBC for Oracle};SERVER=TestServer;UID=user;PWD=password;";

Then include the connection string in the creation of the OdbcConnection object:

System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(connString);

Or after:

System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
conn.ConnectionString = connString;
孤芳又自赏 2024-08-11 07:14:27

对于此类问题,连接字符串是您最好的资源。

For questions like this Connection Strings is your best resource.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文