我有一个mysql插入程序,设置为在另一个程序完成后运行...
我这样做的方式是,初始程序的最后一件事是启动mysql插入程序......这是方法
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "PFML_STATES_MYSQL.exe";
startInfo.Arguments = args[0];
Process.Start(startInfo);
Environment.Exit(0);
我目前正从mysql插入器中的这段代码中获取堆栈跟踪
public void ClearAll(string args)
{
using (MySqlCommand command = new MySqlCommand())
{
command.Connection = this.connection;
if (args.Equals("ny"))
command.CommandText = "delete from jurisdiction where offender_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from offenders_locations where offender_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from vehicles where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from alias where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from marks where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from offender_pictures where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from sentencing_info where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from crimes where offendersXREF IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);delete from offender_pictures_additional where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1);";
else
{
command.CommandText = "delete from jurisdiction where offender_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from offenders_locations where offender_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from vehicles where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from alias where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from marks where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from offender_pictures where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from sentencing_info where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from crimes where offendersXREF IN (select offender_id from offenders WHERE offender_id like 'NY%' AND risk_level !=1 and (county_id = 360052 or county_id = 360099 or county_id = 360030));delete from offender_pictures_additional where offenders_id IN (select offender_id from offenders WHERE offender_id like 'NY%' AND (county_id = 360052 or county_id = 360099 or county_id = 360030) AND risk_level !=1);";
}
command.ExecuteNonQuery();
}
}
我删除了堆栈跟踪,因为我很傻......但它说无法通过command.executereader()>立即完成类似非阻塞套接字操作的操作。 command.executenonquery()
关于这个问题的真正有趣的部分是它只发生在初始程序启动mysql插入器时,如果我手动启动它完全运行的插入器......
错误:
MySql.Data.MySqlClient.MySqlException:期间遇到致命错误 命令执行。 ---> MySql.Data.MySqlClient.MySqlException:致命 尝试读取结果集时遇到错误。 ---> MySql.Data.MySqlClient.MySqlException:从流中读取 失败。 ---> System.IO.IOException:无法从中读取数据 传输连接:无法阻塞套接字操作 马上完成。 ---> System.Net.Sockets.SocketException:A 非阻塞套接字操作无法立即完成
答案 0 :(得分:0)
由于这个问题并不持久,我没有很好的答案......
但是我重新启动了服务器两次并自行修复了它。