[Mono-list] ExecuteReader problem

russell.kay at realtimeworlds.com russell.kay at realtimeworlds.com
Mon Oct 16 05:12:39 EDT 2006


All,

I've just tried 1.1.18 and it has the same problem on the Mac (PowerPC),
I tried the same code on the PC on Mono and it worked fine, could this
be a PowerPC JIT bug??? It could be an ODBC problem on the MAC (I don't
have a Linux install to try it out).

Any pointers to narrowing the problem any further.

Russell


-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of
russell.kay at realtimeworlds.com
Sent: 11 October 2006 18:05
To: mono-list at lists.ximian.com
Subject: [Mono-list] ExecuteReader problem

All,

I'm trying out ODBC on MAC OSX and I'm getting an exception every time I
try to do an ExecuteReader call

The exception output is....

Unhandled Exception: System.ArgumentOutOfRangeException: ArgRange_Array
Parameter name: count
  at System.Text.ASCIIEncoding.GetString (System.Byte[] bytes, Int32
index, Int32 count) [0x00000] 
  at System.Data.Odbc.OdbcDataReader.GetColumnAttributeStr (Int32
column, FieldIdentifier fieldId) [0x00000] 
  at System.Data.Odbc.OdbcDataReader.GetSchemaTable () [0x00000] 
  at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
command, CommandBehavior behavior) [0x00000] 
  at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
command, CommandBehavior behavior, Int32 recordAffected) [0x00000] 
  at (wrapper remoting-invoke-with-check)
System.Data.Odbc.OdbcDataReader:.ctor
(System.Data.Odbc.OdbcCommand,System.Data.CommandBehavior,int)
  at System.Data.Odbc.OdbcCommand.ExecuteReader (CommandBehavior
behavior) [0x00000] 
  at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader (CommandBehavior
behavior) [0x00000] 
  at System.Data.Common.DbCommand.ExecuteReader () [0x00000] 
  at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader
() [0x00000] 
  at DatabaseTest.Program.Main (System.String[] args) [0x00000]

The code I am executing is

    class Program
    {
        static void Main(string[] args)
        {
            //connect to the database at
            //IDbConnection conn = new OdbcConnection(
"DSN=RealTrading;USER=root;PASSWORD=root;" );
            IDbConnection conn = new OdbcConnection("DRIVER={MySQL ODBC
3.51
Driver};SERVER=<ServerName>;DATABASE=<databasename>;USER=<user>;PASSWORD
=<password>;OPTION=3;");
            Console.WriteLine("Connecting to database....");
            conn.Open();


			Stopwatch sw = new Stopwatch();
            IDbCommand dbcmd = conn.CreateCommand();
            dbcmd.CommandText = "SELECT * FROM table WHERE NumLines>10";
            Console.WriteLine( "Executing SQL" );
            sw.Start();
            IDataReader reader = dbcmd.ExecuteReader();
            sw.Stop();
            Console.WriteLine("Elapsed Time = {0}", sw.Elapsed);
            int n = 0;
            while( reader.Read() && (n<20) ) {
                Console.WriteLine( "Sector {0} TOID {1} NumLines {2}
Date {3}", reader["Sector"], reader["TOID"], reader["NumLines"],
reader["Date"] );
                ++n;
            } // end while
            reader.Close();
            reader = null;
            dbcmd.Dispose();
            dbcmd = null;
            conn.Close();
            conn = null;
        }
    }

Any Ideas????

Russell
_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list



DISCLAIMER
This message and any attachments contain privileged and confidential
information intended for the use of the addressee named above. If you
are not the intended recipient of this message, you are hereby notified
that any use, dissemination, distribution or reproduction of this
message is prohibited. Please note that we cannot guarantee that this
message or any attachment is virus free or that it has not been
intercepted and amended. The views of the author may not necessarily
reflect those of Real Time Worlds Ltd.
____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System

____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System


More information about the Mono-list mailing list