Hi!

        I'm testing code example 1a in http://www.mono-project.com/Oracle and
build ok, but execute application return error "Unhandled Exception:
System.InvalidCastException: Cannot cast from source type to destination
type.
in [0x0003d] (at /home/fike/develop/mono/oracle/oracle/Main.cs:24)
oracle.MainClass:Main (System.String[] args".

        The code example:

// project created on 17/5/2006 at 15:15
using System;
using System.Data;
using System.Data.OracleClient;
namespace oracle
{
        class MainClass
        {
                public static void Main(string[] args)
                {
                        string connectionString =
                        "Data Source=tnsname;" +
                        "User ID=user;" +
                        "Password=pass;";
                OracleConnection dbcon = null;
                dbcon = new OracleConnection (connectionString);
                dbcon.Open ();
                OracleCommand dbcmd = dbcon.CreateCommand ();
                string sql = "select cdgprmalv, cdgprmprca from agata.atre3";
                dbcmd.CommandText = sql;
                OracleDataReader reader = dbcmd.ExecuteReader ();
                while (reader.Read ()) {
                        string cdgprmalv = (string) reader["cdgprmalv"];
                        string cdgprmprca = (string) reader["cdgprmprca"];
                        Console.WriteLine("Cdgprmalv: {0} Cdgprmprca: {1}",
                                        cdgprmalv, cdgprmprca); 
                }

                reader.Close ();
                reader = null;
                dbcmd.CommandText = sql;
                dbcmd.ExecuteNonQuery ();
                dbcmd.Dispose ();
                dbcmd = null;
                dbcon.Close ();
                dbcon = null;
                }
        }
}

        What's happen? =)


[]'s
-- 
Fernando Ike - http://fike.homelinux.org:8088/cgi-bin/blosxom
Linux User 303638 - Debian User 352
Jabber - [EMAIL PROTECTED]
I seek You (ICQ)- 160594996

Attachment: signature.asc
Description: Esta é uma parte de mensagem assinada digitalmente

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to