MySQL Lists are EOL. Please join:

List:MySQL and .NET« Previous MessageNext Message »
From:Paulo Augusto Date:February 27 2006 9:46pm
Subject:Only works on MySql 4.1!?
View as plain text  
I'm making a program in mono 1.1.13 using MySql.
I am using the most recent version of the .NET connector dll, 1.0.7(?).

I'm developing it in Linux with MySql 4.1.
When i went to test it in Windows, i installed MySql 4.0. Some commands
would never work (only inserts i think).

I then installed the most recent version, 5.0.1(?). Now, the ones who
were failing became working but some other insterts stopped working.

I went to try against a new instalation of MySql, this time 4.1,
everything worked fime.

All instalations on Windows were made with the default settings.
I tried using the dll for mono, for .net 1.0 and .net 2.0. Apart from
the 2.0 one who did not worked at all, the other 2 presented the exact
same behaviour.

Can anyone help me out trying to figure out what might be wrong?

Here is the code i'm using to access the database:
[code]
...
...
                        comando= "insert into " + nomeTabela + " (" +
                                colunas + ") values (" + conteudo +
");";
                        return BD.ExecutarComando (comando);
...
...

                public static Retorno InicializarString ()
                {
                        Retorno r= new Retorno();

                        conectString= "Server=" + servidor +
";Database=" + baseDados +
                                ";Uid=" + utilizador + ";Pwd=" + passe +
";";
                        //"Encrypt=true;" "Allow Zero Datetime=
true;Connect Timeout=15;"

                        r.sucesso= true;
                        return r;
                }

                public static Retorno ExecutarComando (string
strComando)
                {
                        if (conectString== "") InicializarString();

                        MySqlConnection ligacao= new MySqlConnection
(conectString);
                        MySqlCommand comando= new MySqlCommand
(strComando);
                        Retorno r= new Retorno();

                        comando.Connection= ligacao;
                        try {
                                ligacao.Open();
                        } catch {
                                r.sucesso= false;
                                r.resultadoStr= Textos.ligacaoFalhada;
                                return r;
                        }
                        try {
                                r.resultadoInt= comando.ExecuteNonQuery
();
                                ligacao.Close();
                        } catch {
                                r.sucesso= false;
                                r.resultadoStr= Textos.comandoFalhado;
                                ligacao.Close();
                                return r;
                        }

                        r.sucesso= true;
                        return r;
                }
...
...
[/code]
Thread
Only works on MySql 4.1!?Paulo Augusto27 Feb