using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Using System;
Using System. The Data;
Using System. The Data. SqlClient.
Public class SQLCOM: MonoBehaviour
{
//Start is called before the first frame update
Void the Start ()
{
String s=@ "Server=HUI - GOW \ HUI; The database=Master; Uid=sa; The PWD=123456; ";
SqlConnection con=new SqlConnection (s);
Con. The Open ();
SqlCommand com=new SqlCommand ();
Com. Connection=con;
Com.Com mandType=CommandType. Text;
Com.Com mandText="select HP from ship +"
"Where shipName='the nightingale'";
SqlDataAdapter sda=new SqlDataAdapter (com);
The DataSet ds=new DataSet ();
Sda. The Fill (ds, "ship");
Print (ds);
Ds. The Dispose ();
Con. The Close ();
}
The error message below
SocketException: remote host forced to shut down an existing connection,
System.Net.Sockets.SocketAsyncResult.CheckIfThrowDelayedException () (at & lt; Ae22a4e8f83c41d69684ae7f557133d9 & gt; : 0)
System.Net.EndPoint& System.Net.Sockets.Socket.EndReceiveFrom (System. IAsyncResult asyncResult The endPoint) (at & lt; Ae22a4e8f83c41d69684ae7f557133d9 & gt; : 0)
System.Net.IPEndPoint& System.Net.Sockets.UdpClient.EndReceive (System. IAsyncResult asyncResult RemoteEP) (at & lt; Ae22a4e8f83c41d69684ae7f557133d9 & gt; : 0)
System.Net.Sockets.UdpClient.
System. Threading. Tasks. TaskFactory ` 1 [TResult] FromAsyncCoreLogic (System. IAsyncResult iar, System. Func ` 2 T, TResult endFunction, System. The Action 1 [T] endAction `, System. Threading. The Tasks. The Task ` TResult promise, 1 System. Boolean requiresSynchronization) (at & lt; 437 ba245d8404784b9fbab9b439ac908 & gt; : 0)
Rethrow the as AggregateException: One or more errors occurred.
System. Threading. Tasks. Task. ThrowIfExceptional (System. Boolean includeTaskCanceledExceptions) (at & lt; 437 ba245d8404784b9fbab9b439ac908 & gt; : 0)
System. The Threading. Tasks. Task. Wait (System. Int32 millisecondsTimeout, System. When the CancellationToken CancellationToken) (at & lt; 437 ba245d8404784b9fbab9b439ac908 & gt; : 0)
System. Threading. Tasks. Task. Wait (System. Int32 millisecondsTimeout) (at & lt; 437 ba245d8404784b9fbab9b439ac908 & gt; : 0)
System. The Data. SqlClient. SNI. SSRP. SendUDPRequest (System. String browserHostname, System. Int32 port, System. Byte [] requestPacket) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SNI. SSRP. GetPortByInstanceName (System. String browserHostName, System. String instanceName) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SNI. SNIProxy. CreateTcpHandle (System. The Data. SqlClient. SNI. The DataSource details, System. Int64 timerExpire, System. The Object callbackObject, System. Boolean parallel) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SNI. SNIProxy. CreateConnectionHandle (System. The Object callbackObject, System. String fullServerName, System. Boolean ignoreSniOpenTimeout, System. Int64 timerExpire, System. Byte [] & amp; InstanceName, System. Byte [] & amp; SpnBuffer, System. Boolean flushCache, System. Boolean async, System. Boolean, the parallel System. Boolean isIntegratedSecurity) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SNI. TdsParserStateObjectManaged. CreatePhysicalSNIHandle (System. String serverName, System. Boolean ignoreSniOpenTimeout, System. Int64 timerExpire, System. Byte [] & amp; InstanceName, System. Byte [] & amp; SpnBuffer, System. Boolean flushCache, System. Boolean async, System. Boolean, the parallel System. Boolean isIntegratedSecurity) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. TdsParser. Connect (System. The Data. SqlClient. ServerInfo ServerInfo, System. The Data. SqlClient. SqlInternalConnectionTds connHandler, System. Boolean ignoreSniOpenTimeout, System. Int64 timerExpire, System. Boolean, encrypt System. Boolean trustServerCert, System. Boolean integratedSecurity, System. Boolean withFailover) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SqlInternalConnectionTds. AttemptOneLogin (System. The Data. SqlClient. ServerInfo ServerInfo, System. Boolean ignoreSniOpenTimeout, System. Data. ProviderBase. TimeoutTimer timeout, System. Boolean withFailover) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SqlInternalConnectionTds. LoginNoFailover (System. The Data. SqlClient. ServerInfo ServerInfo, System. Boolean redirectedUserInstance, System. The Data. SqlClient. SqlConnectionString connectionOptions, System. Data. ProviderBase. TimeoutTimer timeout) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
System. The Data. SqlClient. SqlInternalConnectionTds. OpenLoginEnlist (System) Data. ProviderBase. TimeoutTimer timeout, System. The Data. SqlClient. SqlConnectionString connectionOptions, System. Boolean redirectedUserInstance) (at & lt; 290425 a50ff84a639f8c060e2d4530f6 & gt; : 0)
nullnullnullnullnullnullnullnullnullnullnullnullnull