如何修复“尝试读取流的末尾。 (System.io.endofstreamexception)"错误 [英] How to fix "attempted to read past the end of the stream. (System.io.endofstreamexception)" error
问题描述
当我尝试运行我的应用程序时,单击某个按钮,它有时运行良好但有时会抛出此错误。
尝试阅读过去结束流。
(System.IO.EndOfStreamException)
请帮我解决这个问题。
< b>我尝试了什么:
MySqlCommand command = new MySqlCommand( CompetitiveSentimentDistributionByDate,connection);
command.Connection = connection;
command.CommandTimeout = 300 ;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue( @ countries,country);
command.Parameters.AddWithValue( @ gender,性别);
command.Parameters.AddWithValue( @ sources,source);
command.Parameters.AddWithValue( @ sentiments,情绪);
command.Parameters.AddWithValue( @ startdate,sdate);
command.Parameters.AddWithValue( @ enddate,edate);
command.Parameters.AddWithValue( @ keywords,keyword);
command.Parameters.AddWithValue( @ tablename,TableName [t]);
MySqlDataAdapter da = new MySqlDataAdapter();
da.SelectCommand = command;
da.Fill(dtnew);
dt.Merge(dtnew);
dtnew.Clear();
这是我的代码
你好..
它可能对您有所帮助。
引用:当超过net_write_timeout时,MySQL Connector / NET没有抛出EndOfStreamException异常。 (Bug#53439)
Quote:看起来像它会在超过超时时抛出。有一个错误修复它没有这样做,所以如果他们修复它,现在它确实。
http://www.google.com/url?sa = T&安培;源=纸幅放大器; CD = 3及VED = 0CCQQFjAC&安培; URL = HTTP%3A%2F%2Fdownloads.mysql.com%2Fdocs%2Fconnector净en.a4.pdf&安培; EI = isDvTdTDIcregQe-6NSVDw&安培; USG = AFQjCNESAxTm9nhgXMGYvn1KrTnnGp0Wfg&安培; SIG2 = xcHH3gp9XHm3nVuo-w2r7A
when i try to run my application, on clicking some button,it is working well sometimes but throwing this error sometimes.
Attempted to read past the end of the stream.
(System.IO.EndOfStreamException)
please help me resolve this issue.
What I have tried:
MySqlCommand command = new MySqlCommand("CompetitiveSentimentDistributionByDate", connection);
command.Connection = connection;
command.CommandTimeout = 300;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@countries", country);
command.Parameters.AddWithValue("@gender", gender);
command.Parameters.AddWithValue("@sources", source);
command.Parameters.AddWithValue("@sentiments", sentiment);
command.Parameters.AddWithValue("@startdate", sdate);
command.Parameters.AddWithValue("@enddate", edate);
command.Parameters.AddWithValue("@keywords", keyword);
command.Parameters.AddWithValue("@tablename", TableName[t]);
MySqlDataAdapter da = new MySqlDataAdapter();
da.SelectCommand = command;
da.Fill(dtnew);
dt.Merge(dtnew);
dtnew.Clear();
this is my code
Hi ..
It might be helpful for you.
Quote:MySQL Connector/NET did not throw an EndOfStreamException exception when net_write_timeout was exceeded. (Bug #53439)
Quote:It looks like it throws that when the timeout is exceeded. There is a bug fix about it NOT doing so, so if they fixed it, now it does.
http://www.google.com/url?sa=t&source=web&cd=3&ved=0CCQQFjAC&url=http%3A%2F%2Fdownloads.mysql.com%2Fdocs%2Fconnector-net-en.a4.pdf&ei=isDvTdTDIcregQe-6NSVDw&usg=AFQjCNESAxTm9nhgXMGYvn1KrTnnGp0Wfg&sig2=xcHH3gp9XHm3nVuo-w2r7A
这篇关于如何修复“尝试读取流的末尾。 (System.io.endofstreamexception)"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!