Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

C#
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
Posted
Updated 25-May-16 21:36pm
v3
Comments
George Jonsson 26-May-16 3:33am    
In which code line does the error happen?
sandhya46 26-May-16 5:16am    
after da.fill(dtnew)
George Jonsson 26-May-16 6:26am    
Do you mean on that line? I doubt that dt.Merge(dtnew); throws that kind of exception.
Have measured the time taken for the operation?

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900