I got an error message every time when I run the code below. The code is
below, the last line is where the error occurs, could anybody
tell me why and how to solve it?
Thanks a lot!!
for int i=x i<y do (
MySqlCommand select = new MySqlCommand();
select.Connection = conn;
System.Console.WriteLine(select.Connection.State);
select.Parameters.Add("?Start", startDate);
select.Parameters.Add("?End", endDate);
MySqlDataAdapter adapter = new MySqlDataAdapter(select);
select.CommandText =
"SELECT * FROM ticket WHERE Processed = 1 AND CreateTime <= ?End AND " +
"(_EndTime IS NULL OR _EndTime >= ?Start) AND Network = '" + network +
"' ORDER BY TicketNo";
DataSet tickets = new DataSet();
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.MissingMappingAction = MissingMappingAction.Passthrough;
adapter.Fill(tickets, "Ticket");
System.Console.WriteLine("after filling tickets...");
ProgressDialog.Step();
select.CommandText =
"SELECT m.* FROM ticket t, milestone m WHERE Processed = 1 AND
t.CreateTime <= ?End AND " +
"(t._EndTime IS NULL OR t._EndTime >= ?Start) AND t.Network = '" +
network + "' " +
"AND t.ticketno = m.ticketno ORDER BY t.TicketNo";
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.MissingMappingAction = MissingMappingAction.Passthrough;
adapter.Fill(tickets,"Milestone");
-< Error appears here....!!!!!!
) end loop
errorstack looks like this:
Connection unexpectedly terminated
at MySql.Data.MySqlClient.PacketReader.Read(Byte[]&buffer,Int64 pos,Int64
len)
at MySql.Data.MySqlClient.PacketReader.Skip(Int64 count)
at MySql.Data.MySqlClient.PacketReader.OpenPacket()
at MySql.Data.MySqlClient.NativeDriver.OpenDataRow(Int32 fieldCount, Boolean
isBinary)
at MySql.Data.MySqlClient.CommandResult.Consume()
at MySql.Data.MySqlClient.MySqlDataReader.Close()
at MySql.Data.MySqlClient.MySqlDataReader.System.IDisposable.Dispose()
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,Int32
startRecord,Int32 maxRecords,String srcTable,IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
.....
best regards,
Till