B M Suchitra

B M Suchitra

  • NA
  • 507
  • 418.7k

Please suggest me how to separate out the data in ArrayList

Nov 24 2011 12:52 AM
Hi all.

 private string GenerateInsertQRY(string TableName, ArrayList mCol)
        {
            string strColumnName = "";
            string strColumnValue = "";
            string strInsertQRY = null;
            try
            {
                foreach (ClsDMLProperties Columns in mCol)
                {
                    if (!string.IsNullOrEmpty(strColumnName))
                    {
                        strColumnName = strColumnName + ",";
                    }
                    if (!string.IsNullOrEmpty(strColumnValue))
                    {
                        strColumnValue = strColumnValue + ",";
                    }
                    strColumnName = strColumnName + Columns.Col_Name;
                    if (Columns.ReplaceBlankWithNull == false)
                    {
                        if (Columns.IsNumeric == true)
                        {
                            strColumnValue = strColumnValue + Columns.Col_Value;
                        }
                        else
                        {
                            strColumnValue = strColumnValue + "'" + Columns.Col_Value+"'";
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(Columns.Col_Value))
                        {
                            strColumnValue = strColumnValue + "NULL";
                        }
                        else if (Columns.IsNumeric == true)
                        {
                            strColumnValue = strColumnValue + Columns.Col_Value;
                        }
                        else
                        {
                            strColumnValue = strColumnValue + "'" + Columns.Col_Value+"'";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
               
            }
         
        }
===========================
In this method I want to separate out strColumnValue and strColumnName to use them somewhere else.. How can i do this ?

Answers (3)