开发者

can't commit or rollback, MySQL out of sync error on .net

Im having trouble with a stored procedure, I can't commit after I execute it. Its showing this error "[System.Data.Odbc.OdbcException] = {"ERROR [HY000] [MySQL][ODBC 5.1 Driver]Commands out of sync; you can't run this command now"}"

The SP by itself works fine. does anyone have idea of what might be happening?

thanks.

UPDATE: in C# I wasn't closing the reader before commiting.

OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    result = Convert.ToBoolean(reader[0]);
                }
                reader.Close(); //this line was not here when I had the error
        开发者_JAVA技巧        cmd.Transaction.Commit();


I found out what the problem was, I removed select vExito; from the stored procedure and now it works.

i'm just going to erease that since its of no use. was like that because it did something else before and we didn't want to change the .net code, but I guess it must be done.

UPDATE: Also I wasn't closing the reader, when I closed it, it worked; >_>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜