在使用存储过程查询时,出现错误提示:Fatal error encountered during command execution,每次发现查询时间较长时(超出40秒),出现的几率很大,但存储过程本身没什么问题,因为,同样条件,当查询数据较少时也不会出问题。
MySql版本:5.0.27
查询数据表记录大概有200万条,分页得出查询记录后,还要再关联(Join)两个表。

解决方案 »

  1.   

    索引都建了,用MySql Administrator工具执行存储过程是没有问题的,就是时间会久些,1分钟左右吧。
      

  2.   

    Description:
    ExecuteReader() method of the MySqlCommand object displays "Fatal error encountered during
    command execution" message when the simple statement below is executed.select @data := 3, @data * 4;How to repeat:
    MySqlConnection con = new MySqlConnection();
    con.ConnectionString = "Database=sampledb;Data Source=localhost;User Id=root;Password=a";
    con.Open();
    // Connection ok
    string cmdText = "select @data := 3, @data * 4;";
    MySqlCommand cmd = new MySqlCommand(cmdText, con);
    MySqlDataReader r = cmd.ExecuteReader();
    r.Read();
    MessageBox.Show(r.GetInt32(1).ToString());
    r.Close();
    con.Close();
    r.Dispose();
    con.Dispose();[17 Nov 2008 17:26] Reggie Burnett 
    NeohThis is not a bug.  You are attempting to use user variables in your sql.  The default
    mode for Connector/Net assumes you will not be using user variables (as most users don't)
    and so it sees @data and expects to find a parameter named @data.  When it doesn't find
    one it throws an exception.To fix this add 'allow user variables=true' to your connection string.  In this mode it
    will not complain when it sees @data but doesn't find a parameter of that name.
    你的存储过程是否使用了自定义变量?不过你说查询数据量少的时候不出问题,似乎和这个自定义变量又无关。
      

  3.   

    1 我觉得是由于慢查询导致存储过程出现问题的。
    2 在存储过程中增加一些异常机制处理,将出错的内容记录下来。
    3 检查 MySQL 慢查询日志 和 Error 日志,看看是否有记录相关内容。
      

  4.   

    LZ.我也碰到你一样的问题.不知道什么解决.有空敬请回复[email protected]
      

  5.   

    我也是这个问题,很奇怪。还没有解决办法,多多交流哦,[email protected]
      

  6.   

    是查询超时引起的,解决办法:
    dataAdapte.SelectCommand.CommandTimeout=1200; //把超时设长一点就好
      

  7.   

    楼主问题解决没有啊  告知一下  [email protected]  谢谢