2007-10-08 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / class / System.Data / System.Data.Odbc / OdbcCommand.cs
index 0702dc7d1a3e8c6c92eed8484c8303063fc528e4..fd273afb5b695d99bf8ac092008699ddef023bef 100644 (file)
@@ -45,6 +45,7 @@ namespace System.Data.Odbc
        [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.OdbcCommandDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
         [ToolboxItemAttribute ("System.Drawing.Design.ToolboxItem, "+ Consts.AssemblySystem_Drawing)]
 #if NET_2_0
+       [DefaultEvent ("RecordsAffected")]
        public sealed class OdbcCommand : DbCommand, ICloneable
 #else
        public sealed class OdbcCommand : Component, ICloneable, IDbCommand
@@ -132,7 +133,9 @@ namespace System.Data.Odbc
                }
 
                [OdbcDescriptionAttribute ("Time to wait for command to execute")]
+#if NET_1_0 || ONLY_1_1
                 [DefaultValue (30)]
+#endif
                public 
 #if NET_2_0
                override
@@ -171,6 +174,8 @@ namespace System.Data.Odbc
 #endif // ONLY_1_1
 
 #if NET_2_0
+                [DefaultValue (null)]
+                [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
                 public new OdbcConnection Connection
                 {
                         get { return DbConnection as OdbcConnection; }
@@ -182,6 +187,9 @@ namespace System.Data.Odbc
                [BrowsableAttribute (false)]
                 [DesignOnlyAttribute (true)]
                 [DefaultValue (true)]
+#if NET_2_0
+                [EditorBrowsable (EditorBrowsableState.Never)]
+#endif
                public 
 #if NET_2_0
                override
@@ -238,11 +246,9 @@ namespace System.Data.Odbc
                override
 #endif
                UpdateRowSource UpdatedRowSource { 
-                       [MonoTODO]
                                get {
                                        return updateRowSource;
                                }
-                       [MonoTODO]
                                set {
                                        updateRowSource = value;
                                }
@@ -398,8 +404,9 @@ namespace System.Data.Odbc
 
                                ReAllocStatment ();
                                
-                               ret=libodbc.SQLExecDirect(hstmt, sql, sql.Length);
-                               if ((ret!=OdbcReturn.Success) && (ret!=OdbcReturn.SuccessWithInfo)) 
+                               ret = libodbc.SQLExecDirect (hstmt, sql, libodbc.SQL_NTS);
+                               if ((ret != OdbcReturn.Success) && (ret != OdbcReturn.SuccessWithInfo) &&
+                                   (ret != OdbcReturn.NoData))
                                        throw new OdbcException(new OdbcError("SQLExecDirect",OdbcHandleType.Stmt,hstmt));
                                return;
                        }
@@ -432,9 +439,9 @@ namespace System.Data.Odbc
                {
                        int records = 0;
                        if (Connection == null)
-                               throw new InvalidOperationException ();
+                               throw new InvalidOperationException ("No open connection");
                        if (Connection.State == ConnectionState.Closed)
-                               throw new InvalidOperationException ();
+                               throw new InvalidOperationException ("Connection state is closed");
                        // FIXME: a third check is mentioned in .NET docs
 
                        ExecSQL(CommandText);