count() 공개 메소드

public count ( ) : int
리턴 int
예제 #1
0
        public string getSqlParameters()
        {
            var parameters = "";

            for (int i = 0; i < m_parameters.count(); i++)
            {
                var input = m_texts[i];

                m_parameters.item(i).setValue(input.Text);

                var value = "";
                switch (input.Tag.ToString())
                {
                case "T":
                    value = cDataBase.sqlString(input.Text);
                    break;

                case "N":
                    value = cDataBase.sqlNumber(input.Text);
                    break;

                case "F":
                    value = cDataBase.sqlDate(input.Text);
                    break;
                }
                parameters += value + ",";
            }

            if (parameters.Substring(parameters.Length - 1, 1) == ",")
            {
                parameters = parameters.Substring(0, parameters.Length - 1);
            }

            return(parameters);
        }
예제 #2
0
        public bool fillParameters(string dataSource)
        {
            cDataBase db = new cDataBase(csDatabaseEngine.SQL_SERVER);

            if (db.initDb(m_strConnect))
            {
                string[] restrictions = new string[4];
                restrictions[2] = dataSource;
                DataTable dt = db.openSchema("ProcedureParameters", restrictions);

                if (m_parameters == null)
                {
                    m_parameters = new cParameters();
                }

                cParameters parameters = new cParameters();

                foreach (DataRow row in dt.Rows)
                {
                    if (row["parameter_mode"].ToString() != "OUT")
                    {
                        cParameter p     = null;
                        bool       found = false;
                        for (var i = 0; i < m_parameters.count(); i++)
                        {
                            p = m_parameters.item(i);
                            if (p.getName() == row["parameter_name"].ToString())
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            p = null;
                        }
                        p = parameters.add(p, "");
                        p.setName(row["parameter_name"].ToString());
                        p.setPosition((int)row["ordinal_position"]);
                        p.setColumnType(cDatabaseGlobals.getDataTypeFromString(row["data_type"].ToString()));
                    }
                }
                //
                // openSchema can be sorted by any column (usually by name)
                // we need this collection to be sorted by position
                //
                m_parameters = new cParameters();

                for (var j = 1; j < parameters.count() + 1; j++)
                {
                    cParameter p     = null;
                    bool       found = false;
                    for (var i = 0; i < parameters.count(); i++)
                    {
                        p = parameters.item(i);
                        if (p.getPosition() == j)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        throw new Exception("Parameter not found for position: " + j);
                    }
                    else
                    {
                        m_parameters.add(p, p.getKey());
                    }
                }

                return(true);
            }

            return(false);
        }
예제 #3
-35
        public bool fillParameters(string dataSource)
        {
            cDataBase db = new cDataBase(csDatabaseEngine.SQL_SERVER);
            if (db.initDb(m_strConnect))
            {
                string[] restrictions = new string[4];
                restrictions[2] = dataSource;
                DataTable dt = db.openSchema("ProcedureParameters", restrictions);

                if (m_parameters == null) m_parameters = new cParameters();

                cParameters parameters = new cParameters();

                foreach (DataRow row in dt.Rows)
                {
                    if (row["parameter_mode"].ToString() != "OUT") 
                    {
                        cParameter p = null;
                        bool found = false;
                        for (var i = 0; i < m_parameters.count(); i++)
                        { 
                            p = m_parameters.item(i);
                            if (p.getName() == row["parameter_name"].ToString())
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found) p = null;
                        p = parameters.add(p, "");
                        p.setName(row["parameter_name"].ToString());
                        p.setPosition((int)row["ordinal_position"]);
                        p.setColumnType(cDatabaseGlobals.getDataTypeFromString(row["data_type"].ToString()));
                    }
                }
                //
                // openSchema can be sorted by any column (usually by name)
                // we need this collection to be sorted by position
                //
                m_parameters = new cParameters();

                for (var j = 1; j < parameters.count() + 1; j++)
                {
                    cParameter p = null;
                    bool found = false;
                    for (var i = 0; i < parameters.count(); i++)
                    {
                        p = parameters.item(i);
                        if (p.getPosition() == j)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        throw new Exception("Parameter not found for position: " + j);
                    }
                    else
                    {
                        m_parameters.add(p, p.getKey());
                    }
                }
                
                return true;
            }

            return false;
        }