C# 使用.NET应用程序通过网络(INTRANET)共享

C# 使用.NET应用程序通过网络(INTRANET)共享,c#,.net,sql-server,C#,.net,Sql Server,我正在使用.NET2.0和SQLServer2005开发一个winforms应用程序。我只想从存在SqlServer数据库的计算机上重设另一台PC上的值 我在App.Config中完成的appsettings如下所示: <configuration> <appSettings> <add key="DatabasePath" value="Data Source=192.168.1.34,1433;Network Library=DBM

我正在使用.NET2.0和SQLServer2005开发一个winforms应用程序。我只想从存在SqlServer数据库的计算机上重设另一台PC上的值

我在App.Config中完成的appsettings如下所示:

    <configuration>
  <appSettings>
    <add key="DatabasePath"
     value="Data Source=192.168.1.34,1433;Network Library=DBMSSOCN;
     Initial Catalog=testingdb;User ID=sa;pwd=pass;"/>
  </appSettings>
</configuration>

但是,我无法从服务器检索到另一台计算机的值(名称和年龄)。 请给我一个解决方案

检索时显示以下错误:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at OnlineTest.AdminUser.adminenter() in F:\Online Test - Intranet\OnlineTest\OnlineTest\AdminUser.cs:line 63
   at OnlineTest.AdminUser.btnok_Click(Object sender, EventArgs e) in F:\Online Test - Intranet\OnlineTest\OnlineTest\AdminUser.cs:line 56
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
OnlineTest
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/SystemOrganization/Setup1/OnlineTest.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
有关调用的详细信息,请参阅此消息的结尾
即时(JIT)调试,而不是此对话框。
**************例外文本**************
System.Data.SqlClient.SqlException:与服务器建立连接时出错。连接到SQL Server 2005时,此故障可能是因为在默认设置下,SQL Server不允许远程连接。(提供程序:TCP提供程序,错误:0-连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应。)
位于System.Data.SqlClient.SqlInternalConnection.OneError(SqlException异常,布尔断开连接)
位于System.Data.SqlClient.TdsParser.ThroweException和Warning(TdsParserStateObject stateObj)
在System.Data.SqlClient.TdsParser.Connect(Boolean&useFailoverPartner、Boolean&failoverDemandDone、字符串主机、字符串failoverPartner、字符串协议、sqlinternalconnectionds-connHandler、Int64 timerExpire、Boolean加密、Boolean信任服务器证书、Boolean集成安全、SqlConnection-owningObject、Boolean别名查找)
位于System.Data.SqlClient.SqlInternalConnectionDS.OpenLoginList(SqlConnection-owningObject、SqlConnectionString-connectionOptions、String-newPassword、Boolean-redirectedUserInstance)
位于System.Data.SqlClient.SqlInternalConnectionDS..ctor(DbConnectionPoolIdentity、SqlConnectionString connectionOptions、Object providerInfo、String newPassword、SqlConnection owningObject、Boolean redirectedUserInstance)
位于System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项、对象池组ProviderInfo、DbConnectionPool池、DbConnection所有者连接)
位于System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection所有者连接、DbConnectionPool池、DbConnectionOptions选项)
位于System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
位于System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
位于System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
位于System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection-owningConnection)
位于System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)
在System.Data.SqlClient.SqlConnection.Open()处
在F:\Online Test-Intranet\OnlineTest\OnlineTest\AdminUser.cs中的OnlineTest.AdminUser.adminenter()处:第63行
在OnlineTest.AdminUser.btnok_中,单击F:\Online Test-Intranet\OnlineTest\OnlineTest\AdminUser.cs:第56行中的(对象发送者,事件参数e)
在System.Windows.Forms.Control.OnClick(EventArgs e)中
在System.Windows.Forms.Button.OnClick(EventArgs e)中
在System.Windows.Forms.Button.OnMouseUp(MouseEventArgs-mevent)上
在System.Windows.Forms.Control.WmMouseUp(Message&m、MouseButtons按钮、Int32单击)
位于System.Windows.Forms.Control.WndProc(Message&m)
位于System.Windows.Forms.ButtonBase.WndProc(Message&m)
在System.Windows.Forms.Button.WndProc(Message&m)中
在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&m)中
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)中
在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd、Int32 msg、IntPtr wparam、IntPtr lparam)中
**************加载的程序集**************
mscorlib
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
在线测试
程序集版本:1.0.0.0
Win32版本:1.0.0.0
代码库:file:///C:/Program%20Files/SystemOrganization/Setup1/OnlineTest.exe
----------------------------------------
System.Windows.Forms
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
系统
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
系统图
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
系统配置
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
命名空间
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
系统数据
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
系统.交易
程序集版本:2.0.0.0
Win32版本:2.0.50727.42(RTM.050727-4200)
代码库:file:///C:/WINDOWS