Ошибка при получении даных из SQL
не могу понять что за ошибка
кодировки везде правильно стоят запись работает но на строчке rdr = cmd.ExecuteReader(); выскакивает ошибка Гугл не помог (( Код: using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; using MySql.Data.MySqlClient; using MySql.Data; using System.Runtime; using System; using System.Data; public class tst : MonoBehaviour { string constr = "Server=localhost;Database=testunity8;User ID=root;Password=root;CharSet=utf8;port=3306"; MySqlConnection con = null; // command object "Server=localhost;Database=easychild;User ID=root;Password=root;Pooling=true" MySqlCommand cmd = null; // reader object MySqlDataReader rdr = null; // Start is called before the first frame update void Awake() { con = new MySqlConnection(constr); con.Open(); Debug.Log("Connection State: " + con.State); } void OnApplicationQuit() { if (con != null) { if (con.State.ToString() != "Closed") con.Close(); con.Dispose(); } Debug.Log("killing con"); } public void loadData() { string query = "SELECT * FROM test;"; try { if (con.State.ToString() != "Open") con.Open(); using (cmd = new MySqlCommand(query, con)) { rdr = cmd.ExecuteReader(); if (rdr.HasRows) while (rdr.Read()) { Debug.Log(rdr[1]); } rdr.Dispose(); } } catch (Exception ex) { Debug.Log(ex.ToString()); } } } error: MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Expected end of data packet at MySql.Data.MySqlClient.NativeDriver.CheckEOF () [0x00017] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.NativeDriver.ReadEOF () [0x00011] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.NativeDriver.GetColumnsData (MySql.Data.MySqlClient.MySqlField[] columns) [0x00017] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.Driver.GetColumns (System.Int32 count) [0x0001c] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.ResultSet.LoadColumns (System.Int32 numCols) [0x00000] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.ResultSet..ctor (MySql.Data.MySqlClient.Driver d, System.Int32 statementId, System.Int32 numCols) [0x00029] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId) [0x00035] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00053] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00116] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00052] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlCommand.ResetReader () [0x00020] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x002d1] in <326e9aab93854e739606c3572c385a34>:0 at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] in <326e9aab93854e739606c3572c385a34>:0 at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.ExecuteReader( ) at Join.loadData () [0x0005d] in C:\Users\tim\Documents\UnityProject\EasyChild\Asse ts\script\sqlLoginJoin\Join.cs:77 UnityEngine.Debug:Log(Object) Join:loadData() (at Assets/script/sqlLoginJoin/Join.cs:90) |
Встречал подобное при некоторых комбинациях некоторых антивирусов с некоторыми версиями SQL-серверов :)
Лечил заменой антивируса. |
Часовой пояс GMT +4, время: 01:51. |
Powered by vBulletin® Version 4.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.