Exemplo n.º 1
0
        public String getUpdateParmSQL(String cWhereParm)
        {
            StringBuilder ValueList = new StringBuilder();

            for (int i = 0; i < FieldList.Count; i++)
            {
                JActiveField aField      = FieldList[i];
                String       cFieldName  = aField.FieldName;
                String       cFieldValue = aField.FieldValue;
                if (String.IsNullOrWhiteSpace(cFieldValue))
                {
                    cFieldValue = null;
                }
                else
                {
                    cFieldValue = "'" + cFieldValue + "'";
                }

                if (i == 0)
                {
                    ValueList.Append(cFieldName + "=@" + cFieldName.ToLower());
                    ParmList.Add(cFieldValue);
                }
                else
                {
                    ValueList.Append("," + cFieldName + "=@" + cFieldName.ToLower());
                    ParmList.Add(cFieldValue);
                }
            }
            return("UPDATE " + TableName + " SET " + ValueList + " WHERE " + cWhereParm);
        }
Exemplo n.º 2
0
        public String getInsertParmSQL()
        {
            StringBuilder sbFieldList = new StringBuilder();
            StringBuilder sbValueList = new StringBuilder();

            for (int i = 0; i < FieldList.Count; i++)
            {
                JActiveField aField      = FieldList[i];
                String       cFieldName  = aField.FieldName;
                String       cFieldValue = aField.FieldValue;
                if (String.IsNullOrWhiteSpace(cFieldValue))
                {
                    continue;
                }
                if (sbFieldList.Length == 0)
                {
                    sbFieldList.Append(cFieldName);
                    sbValueList.Append(" @" + cFieldName + "");
                    ParmList.Add(cFieldValue);
                }
                else
                {
                    sbFieldList.Append("," + cFieldName + "");
                    sbValueList.Append(" @" + cFieldName + "");
                    ParmList.Add(cFieldValue);
                }
            }
            return("INSERT INTO " + TableName + "(" + sbFieldList + ") VALUES(" + sbValueList + ")");
        }
Exemplo n.º 3
0
        public int Find(String cFieldName)
        {
            int idx = -1;

            for (int i = 0; i < FieldList.Count; i++)
            {
                JActiveField aField = FieldList[i];
                if (cFieldName.ToLower().Equals(aField.FieldName.ToLower()))
                {
                    idx = i;
                    break;
                }
            }
            return(idx);
        }
Exemplo n.º 4
0
        public int AddField(String cFieldName, double dVal)
        {
            int idx = Find(cFieldName);

            if (idx == -1)
            {
                JActiveField vField = new JActiveField(cFieldName, dVal);
                FieldList.Add(vField);
                return(FieldList.Count - 1);
            }
            else
            {
                return(idx);
            }
        }
Exemplo n.º 5
0
        public int AddField(JActiveField vField)
        {
            int idx = Find(vField.FieldName);

            if (idx == -1)
            {
                FieldList.Add(vField);
                return(FieldList.Count - 1);
            }
            else
            {
                FieldList[idx] = vField;
                return(idx);
            }
        }
Exemplo n.º 6
0
        public int AddField(String cFieldName, int iVal)
        {
            int idx = Find(cFieldName);

            if (idx == -1)
            {
                JActiveField vField = new JActiveField(cFieldName, iVal);
                FieldList.Add(vField);
                return(FieldList.Count - 1);
            }
            else
            {
                FieldList[idx].FieldValue = StringEx.getString(iVal);
                return(idx);
            }
        }