【问题标题】:Get connection string of non server machine( SQL) using c#使用c#获取非服务器机器(SQL)的连接字符串
【发布时间】:2012-08-04 03:51:29
【问题描述】:

我正在使用 c#.net 开发 Windows 窗体应用程序。我开发了一个使用 sql 数据库作为后端的应用程序。使用本地服务器我正在工作。现在我需要在网络上有服务器的客户端机器上工作(非服务器机器)。我如何使用非服务器机器)。

请指导我。

【问题讨论】:

    标签: sql-server c#-4.0 connection-string sqlconnection


    【解决方案1】:

    修改您的连接字符串。而不是本地主机或“。”或您的机器名称,使用服务器机器名称和 sqlinstance 名称。有关连接字符串的更多信息,请查看http://www.connectionstrings.com

    【讨论】:

    • 感谢您的回复..我不知道服务器机器名称和 sqlinstance 名称。我可以使用 Remove Integrated Security=True
    【解决方案2】:

    假设当你执行你的应用程序时,它的地址是

        http://localhost/pagename.aspx/formname
    

    因此,您可以通过将 localhost 替换为机器的 ip 地址来访问它

    http://10.123.4.56/pagename.aspx/formname
    

    【讨论】:

    • 我正在使用 Windows 应用程序。
    • 这是本地服务器连接字符串:string connection = "data source=localhost;initial catalog=TWO;integrated security=SSPI;persist security info=False;packet size=4096";
    猜你喜欢
    • 2014-01-14
    • 2012-03-04
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多