Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在网络上共享C#程序_C#_Sql Server_Share_Sqlcmd - Fatal编程技术网

在网络上共享C#程序

在网络上共享C#程序,c#,sql-server,share,sqlcmd,C#,Sql Server,Share,Sqlcmd,我在网络上共享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 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; 
程序无法连接到数据库


在网络中共享此程序,您有什么想法吗?

如果您询问如何使用目录名调用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)
更多细节可在此处找到

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

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

您可能不应该在公共网站上发布登录信息。这是本地地址,其他人无法访问,谢谢您的编辑。不,我还有一个问题,我找到了我问题的解决方案,我通过创建来宾用户解决了这个问题,并获得了足够的权限。@amin然后将这个问题更改为您需要的问题,或者删除这个问题,然后创建一个新的问题