[Mono-dev] Problem with national character set on ODBC connection

Andreas Nahr ClassDevelopment at A-SoftTech.com
Thu Feb 14 02:55:25 EST 2008


Don't use mkbundle in the first place.
I doubt that it is able to "magically" embedd just the I18N resources you
want (because I18N uses heavy reflection and the needed ones are not
specified).
If it is possible to change your database/datasource to return Unicode it
might work, though.

Greetings
Andreas

> -----Ursprüngliche Nachricht-----
> Von: mono-devel-list-bounces at lists.ximian.com 
> [mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag 
> von Torello Querci
> Gesendet: Mittwoch, 13. Februar 2008 18:01
> An: Mono-devel-list at lists.ximian.com
> Betreff: [Mono-dev] Problem with national character set on 
> ODBC connection
> 
> Hi to all .....
> 
> I try to make an ODBC connection on windows environment.
> Using normal ascii character that code work fine, but if 
> there is some national character, the result is wrong.
> The result is wrong only if I make a bundle, not if I use 
> mono <program_name.exe> or if I use .NET.
> I tried both the 1.2.6 and the 1.9 preview and the result is the same.
> 
> Is there a bug or I wrong something when generate the bundle
> 
> To generate the bundle I simply use this command:
> mkbundle2 --deps -o odbx2xml.exe program.exe
> 
> 
> Best Regards, Torello.
> 
> The testing database is an access file with one table named "users"
> with 3 column: name, surname, description with only one row ....
> 
> Here you can find the code:
> --------------------------------------------------------------
> ----------------
> using System;
> using System.Collections;
> using System.Collections.Generic;
> using System.Text;
> using System.Data.Odbc;
> 
> namespace test_odbc
> {
>     class testOdbc : IDisposable
>     {
>         private System.Data.Odbc.OdbcConnection connection = null;
> 
>         public testOdbc(string connectionString)
>         {
>             connection=new OdbcConnection(connectionString);
>             try
>             {
>                 connection.Open();
>             }
>             catch (Exception ex)
>             {
>                 connection = null;
>                 System.Console.Out.WriteLine("Exception 
> opening the database connection: " + ex.Message);
>             }
> 
>             return;
>         }
> 
>         public System.Data.Common.DbDataReader 
> getRawData(string sqlQuery)
>         {
>             System.Data.Odbc.OdbcCommand 
> command=connection.CreateCommand();
>             command.CommandText = sqlQuery;
>             command.CommandType = System.Data.CommandType.Text;
>             OdbcDataReader reader = command.ExecuteReader();
> 
>             return reader;
>         }
> 
>         public System.Collections.ArrayList 
> getListOfFields(System.Data.Common.DbDataReader reader)
>         {
>             ArrayList fieldNameList = new ArrayList();
>             System.Data.DataTable dataTable = reader.GetSchemaTable();
>             foreach (System.Data.DataRow row in dataTable.Rows)
>             {
>                 if 
> (!fieldNameList.Contains(row["Co6lumnName"].ToString())) {
>                     fieldNameList.Add(row["ColumnName"].ToString());
>                 }
>             }
>             dataTable.Dispose();
> 
>             return fieldNameList;
>         }
> 
>         public void Dispose()
>         {
>             if (connection != null)
>             {
>                 connection.Close();
>             }
> 
>         }
> 
>         static void Main(string[] args)
>         {
>             testOdbc odbc = new testOdbc("Dsn=test");
>             System.Data.Common.DbDataReader reader = 
> odbc.getRawData("select * from users");
>             while (reader.Read())
>             {
>                 for (int i = 0; i < reader.FieldCount; i++)
>                 {
>                     object obj = reader.GetValue(i);
>                     System.Console.Out.WriteLine("column " + i + "
> data: " + reader.GetValue(i).ToString());
>                 }
>                 System.Console.Out.WriteLine("-----");
>             }
>         }
>     }
> }
> _______________________________________________
> 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