栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > .Net

mysql 尝试读取超过流末尾的

.Net 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

mysql 尝试读取超过流末尾的

我遇到MySQL的问题,我有以下错误.

MySqlClient.MySqlException: Fatal error encountered during command execution. --->

MySql.Data.MySqlClient.MySqlException: Fatal error encountered attempting to read the resultset. --->

MySql.Data.MySqlClient.MySqlException: Reading from the stream has failed. --->

System.IO.EndOfStreamException: Attempted to read past the end of the stream.

我在夜间运行时会发生此错误.并且它很少发生,所以很难找到为什么会发生这种情况.我使用.NET 3.5与MySQLConnector 6.2.4.0.

我正在使用以下代码运行它.

public DataSet Read(String query, List> parameters)

{

MySqlDataAdapter adapter = null;

DataSet returnVal = null;

if (query != null && query.Length > 0)

{

try

{

returnVal = new DataSet();

if (connection.State != ConnectionState.Open)

{

connection.Open();

}

query = SQLHelper.formatSQL(query);

MySqlCommand command = buildCommand(connection, query, parameters);

Stopwatch stopwatch = new Stopwatch();

command.CommandTimeout = 120;

adapter = new MySqlDataAdapter(command);

log.Debug(adapter.SelectCommand.CommandText);

stopwatch.Start();

adapter.Fill(returnVal);

stopwatch.Stop();

if (stopwatch.ElapsedMilliseconds < 150)

{

log.Debug(stopwatch.ElapsedMilliseconds + "ms to run query");

}

else

{

StringBuilder sb = new StringBuilder("");

if (parameters != null)

{

foreach (KeyValuePair kvp in parameters)

{

sb.Append(kvp.Key);

sb.Append(" = ");

if (kvp.Value != null)

{

sb.Append(kvp.Value.ToString());

}

else

{

sb.Append("NULL");

}

sb.Append(", ");

}

}

log.Warn(stopwatch.ElapsedMilliseconds + "ms to run query: " + adapter.SelectCommand.CommandText + "Values: " + sb.ToString());

}

}

catch (MySqlException msqlex)

{

log.Error(msqlex);

returnVal = null;

MessageBox.Show(query + "rn" + msqlex.ToString());

}

finally

{

}

}

else

{

log.Error("Query is empty. Returning null");

}

return returnVal;

}

正如您所看到的,我并非手动尝试阅读任何内容>

为什么会发生这种情况?

如果您需要更多详细信息,请与我们联系.

解决方法:

当超过超时时,它看起来像是抛出了它.有一个错误修复它没有这样做,所以如果他们修复它,现在它确实.

当超过net_write_timeout时,MySQL Connector / NET没有抛出EndOfStreamException异常.

(缺陷号53439)

标签:ioexception,mysql,net,connector

来源: https://codeday.me/bug/20191006/1859729.html

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/955228.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号