Summary description for DB2ClientDataReader. DB2ClientDataReader.
Inheritance: System.MarshalByRefObject, IDataReader
Example #1
0
 //View Data
 public DB2DataReader ExecDataView(String sql)
 {
     if (this.ConnectDatabase() == true)
     {
         Cmd = new DB2Command(sql, Conn);
         Resultset = Cmd.ExecuteReader();
     }
     return Resultset;
 }
Example #2
0
 public static string GetDBValueStr(DB2DataReader reader, string columnName, string defaultValue = "")
 {
     if (reader[columnName] == DBNull.Value)
     {
         return defaultValue;
     }
     else
     {
         string value = string.Empty;
         value = reader[columnName].ToString();
         return value;
     }
 }
Example #3
0
 public static int GetDBValueInt(DB2DataReader reader, string columnName, int defaultValue = -1)
 {
     if (reader[columnName] == DBNull.Value)
     {
         return defaultValue;
     }
     else
     {
         string value = string.Empty;
         value = reader[columnName].ToString();
         return Convert.ToInt32(value);
     }
 }
Example #4
0
 public static DateTime GetDBValueDateTime(DB2DataReader reader, string columnName, string defaultValue = "0000-01-01")
 {
     if (reader[columnName] == DBNull.Value)
     {
         return Convert.ToDateTime(defaultValue);
     }
     else
     {
         string value = string.Empty;
         value = reader[columnName].ToString();
         return Convert.ToDateTime(value);
     }
 }
Example #5
0
        private DataTable GetSchema()
        {
            dataAdapter.SelectCommand.Connection.Open();
            DB2Command    cmd  = new DB2Command(dataAdapter.SelectCommand.CommandText, dataAdapter.SelectCommand.Connection);
            DB2DataReader fake = cmd.ExecuteReader(CommandBehavior.KeyInfo);

            DataTable dt = fake.GetSchemaTable();

            fake.Close();
            dataAdapter.SelectCommand.Connection.Close();

            return(dt);
        }
Example #6
0
        ///
        /// ExecuteScalar
        ///
        public object ExecuteScalar()
        {
            if ((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
            {
                throw new InvalidOperationException("Prepare needs an open connection");
            }

            using (DB2DataReader reader = ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SingleRow))
            {
                if (reader.Read() && (reader.FieldCount > 0))
                {
                    return(reader[0]);
                }
            }
            return(null);
        }
Example #7
0
        public DB2DataReader ExecuteReader(CommandBehavior behavior)
        {
            if ((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
            {
                throw new InvalidOperationException("Prepare needs an open connection");
            }

            DB2DataReader reader;

            ExecuteNonQueryInternal(behavior);
            reader = new DB2DataReader(db2Conn, this, behavior);

            refDataReader = new WeakReference(reader);

            return(reader);
        }
Example #8
0
        internal void ConnectionClosed()
        {
            DB2DataReader reader = null;

            if ((refDataReader != null) && refDataReader.IsAlive)
            {
                reader = (DB2DataReader)refDataReader.Target;
            }
            if ((reader != null) && refDataReader.IsAlive)
            {
                reader.Dispose();
                refDataReader = null;
            }
            CloseStatementHandle(true);

            db2Trans = null;
        }
Example #9
0
        public static bool GetDBValueBool(DB2DataReader reader, string columnName, bool defaultValue = false)
        {
            if (reader[columnName] == DBNull.Value)
            {
                return defaultValue;
            }
            else
            {
                string value = string.Empty;
                value = reader[columnName].ToString();

                string[] yesParas = { "1", "Y" };

                if (yesParas.Contains(value))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
		public DB2DataReader ExecuteReader(CommandBehavior behavior)
		{
			if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
				throw new InvalidOperationException("Prepare needs an open connection");

			DB2DataReader reader;
			
			ExecuteNonQueryInternal(behavior);
			reader = new DB2DataReader(db2Conn, this, behavior);
			
			refDataReader = new WeakReference(reader);

			return reader;
		}
 protected internal DB2SpatialExtenderFeatureDataReader(
     IGeometryFactory geomFactory, DB2DataReader internalReader,
     string geometryColumn, string oidColumn) :
         base(geomFactory, internalReader, geometryColumn, oidColumn)
 {
 }