[Mono-dev] Only works on MySql 4.1!?

Paulo Augusto PauloMorfeo at portugalmail.pt
Sun Mar 5 14:27:18 EST 2006


Thanks, that was really helpfull! Tried 3 other (MySql) places and that
was the first answer i got. Dumb me for not having remembered about
catching the exception.

The problem was that, while 4.1 and 5.0 accepts "False" and "True" for
booleans, 4.0 does not. And, while 4.0 and 4.1 do not need all "not
null" fields to be filled (automatically assigning them 0), 5.0 does.

Thanks!



Sáb, 2006-03-04 às 14:07 -0600, Victor Romero escreveu:
> Hi,
> 
> You can get more information about the Exception with something like
> 
> catch (Exception e){
>     //Your code
>     Console.WriteLine("Message Error " + e.Message());
>     Console.WriteLine("StackTrace Error " + e.StackTrace());
> }
> 
> I have used the Connector .NET 1.0.6 and 1.0.7 with Mono 1.13.2 with
> no problems on Linux (Fedora Core 3 and 4), Solaris 10 (Sparc), and
> Windows XP Professional and with MySQL 4.0, 4.1 and 5.0 .
> 
> You can look at the code  that I use at 
> 
> http://www.linux.ipn.mx/cms/space/El+Cartel+de+Tux/Mono+Pet+Shop
> 
> Please provide more information about the Exceptions :) 
> 
> -- 
> 
> Victor Romero
> 
> Messenger: vic_romero at hotmail.com
> Business Web Page: http://www.dsnibble.com.mx
> Personal Web Page: http://linux.ipn.mx/cms/space/VictorRomero
> Blog Web Page: http://elcarteldetux.blogspot.com
> 
> On 3/2/06, Paulo Augusto <PauloMorfeo at portugalmail.pt> wrote:
>         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 inserts
>         would never work.
>         - 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]
>         
>         
>         --
>         The quick brown Firefox jumps over the lazy Internet
>         Explorer! 
>         _______________________________________________
>         Mono-devel-list mailing list
>         Mono-devel-list at lists.ximian.com
>         http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 
> 
> 



More information about the Mono-devel-list mailing list