[Mono-dev] problem with mono 1.1.12.1

cartuchoGL cartuchogl at unrealspace.com
Tue Dec 27 11:07:49 EST 2005


Hello,

I have a program will use Datasets and run fine with mono 1.1.9 compiled 
with gmcs, but with
1.1.12.1 throw an exception System.NotImplementedException, the same app 
compiled with mcs not fail.

This piece of code fail when run if compiled with gmcs

//* gmcs -warn:4 Example10.cs -r:System.Data -r:Npgsql */
using System;
using System.Data;
using Npgsql;
/*
 CREATE TABLE table2(
  field_int2 int2,
  field_timestamp timestamp,
  field_numeric numeric
 );
*/
public class Example10 {
  public static void Main() {       
    string strCon =
      "Server=localhost;"+
      "User Id=postgres;"+
      "Password=xxxx;"+
      "Database=tests;";
    NpgsqlConnection conn = new NpgsqlConnection(strCon);
    conn.Open();

    NpgsqlDataAdapter da = new NpgsqlDataAdapter();
    DataSet ds = new DataSet();
   
    string strCommand = "SELECT * FROM table2 WHERE 1=2";
    NpgsqlCommand selCommand = new NpgsqlCommand(strCommand,conn);
    selCommand.CommandType = CommandType.Text;

    strCommand = "INSERT INTO table2 "+
      "(field_int2,field_timestamp,field_numeric) "+
      "VALUES (:a, :b, :c)";
    NpgsqlCommand insCommand = new NpgsqlCommand(strCommand,conn);

    insCommand.Parameters.Add
      (new NpgsqlParameter("a", DbType.Int16));
    insCommand.Parameters.Add
      (new NpgsqlParameter("b", DbType.DateTime));
    insCommand.Parameters.Add
      (new NpgsqlParameter("c", DbType.Decimal));

    insCommand.Parameters[0].Direction =
    insCommand.Parameters[1].Direction =
    insCommand.Parameters[2].Direction =
      ParameterDirection.Input;

    insCommand.Parameters[0].SourceColumn =
      "field_int2";
    insCommand.Parameters[1].SourceColumn =
      "field_timestamp";
    insCommand.Parameters[2].SourceColumn =
      "field_numeric";

    da.SelectCommand = selCommand;
    da.InsertCommand = insCommand;
   
    da.Fill(ds,"table2");

    DataTable dt = ds.Tables["table2"];

    DataRow dr = dt.NewRow();
    dr["field_int2"] = 4;
    dr["field_timestamp"] = new DateTime(2003, 03, 03, 14, 0, 0);
    dr["field_numeric"] = 7.3M;

    dt.Rows.Add(dr);
   
    da.Update(ds,"table2");
   
    conn.Close();
  }
}

Output is:
Unhandled Exception: System.NotImplementedException: The requested 
feature is not implemented.
in <0x0001d> System.Data.Common.DbDataAdapter:get_SelectCommand ()
in <0x0001a> System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet 
dataSet, System.String srcTable)
in (wrapper remoting-invoke-with-check) 
System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
in <0x0031e> Example10:Main ()

Any ideas?
Thanks.





More information about the Mono-devel-list mailing list