【问题标题】:Share C# program on network在网络上共享 C# 程序
【发布时间】:2013-09-05 22:43:41
【问题描述】:

我在网络上共享 C# 程序时遇到问题。

我安装了 SQL Server 2008 R2 并在其上启用了 TCP/IP 和远程连接,我也可以使用 sqlcmd -U usr -P pwd -S 192.168.1.11\SQLEXPRESS 毫无问题地连接到服务器,但是当我像这样更改连接字符串时:

192.168.1.11\SQLEXPRESS;initial catalog=HouseTrade;User ID=usr;Password=pwd; 

程序无法连接数据库。

你有什么想法在网络上分享这个程序吗?

【问题讨论】:

  • 您可能不应该在公共网站上发布登录信息。
  • 这是本地地址,其他人无法访问,感谢您的精心编辑

标签: c# sql-server share sqlcmd


【解决方案1】:

我找到了解决方案。我们可以添加访客用户并获得足够的权限 之后我们可以使用这个连接字符串:

data source=ip\SQLEXPRESS;initial catalog=HouseTrade;integrated security=true;

【讨论】:

    【解决方案2】:

    如果您询问如何调用带有目录名称的 SQLCMD

    sqlcmd -U usr -P pwd -d HouseTrade -S 192.168.1.11\SQLEXPRESS
    

    如果这不是您要问的,请编辑您的问题以使其清楚

    sqlcmd 
       -a packet_size
       -A (dedicated administrator connection)
       -b (terminate batch job if there is an error)
       -c batch_terminator
       -C (trust the server certificate)
       -d db_name
       -e (echo input)
       -E (use trusted connection)
       -f codepage | i:codepage[,o:codepage] | o:codepage[,i:codepage]
       -h rows_per_header
       -H workstation_name
       -i input_file
       -I (enable quoted identifiers)
       -k[1 | 2] (remove or replace control characters)
       -K application_intent
       -l login_timeout
       -L[c] (list servers, optional clean output)
       -m error_level
       -M multisubnet_failover
       -N (encrypt connection)
       -o output_file
       -p[1] (print statistics, optional colon format)
       -P password
       -q "cmdline query"
       -Q "cmdline query" (and exit)
       -r[0 | 1] (msgs to stderr)
       -R (use client regional settings)
       -s col_separator
       -S [protocol:]server[\instance_name][,port]
       -t query_timeout
       -u (unicode output file)
       -U login_id
       -v var = "value"
       -V error_severity_level
       -w column_width
       -W (remove trailing spaces)
       -x (disable variable substitution)
       -X[1] (disable commands, startup script, environment variables and optional exit)
       -y variable_length_type_display_width
       -Y fixed_length_type_display_width
       -z new_password 
       -Z new_password (and exit)
    
       -? (usage)
    

    更多细节可以在这里找到 http://technet.microsoft.com/en-us/library/ms162773.aspx

    【讨论】:

    • 不,我还有一个问题,我找到了我的问题的解决方案,我通过创建访客用户解决了它并获得了足够的权限。
    • @amin 然后将此问题更改为您需要的问题或删除此问题并创建一个新问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 1970-01-01
    相关资源
    最近更新 更多