Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.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# Mysql更新时出错:无法将数据写入传输连接_C#_Mysql_Updates - Fatal编程技术网

C# Mysql更新时出错:无法将数据写入传输连接

C# Mysql更新时出错:无法将数据写入传输连接,c#,mysql,updates,C#,Mysql,Updates,尝试更新时,我遇到以下错误: 我正在使用普通的mysql更新查询 System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly

尝试更新时,我遇到以下错误:

我正在使用普通的mysql更新查询

 System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at MySql.Data.MySqlClient.MySqlStream.SendPacket(MySqlPacket packet)
   at MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySqlPacket packetToExecute)
   at MySql.Data.MySqlClient.NativeDriver.SetDatabase(String dbName)
   at MySql.Data.MySqlClient.MySqlConnection.ChangeDatabase(String databaseName)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at PushSMS.Form1.findSMS_Tick(Object sender, EventArgs e) in D:\PushSMS\Form1.cs:line 185 Frequency=1

第185行的代码是什么?您能连接吗?检查正在使用的端口3306是否可以将源代码粘贴到此处重试{if connectToVr2.State==ConnectionState.Closed{connectToVr2.Open;}updatecmd=connectToVr2.CreateCommand;updatecmd.CommandText=strupdate;updatecmd.ExecuteOnQuery;}粘贴完整堆栈跟踪。这还不是全部。