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 ?
Loading

VulpesPosted Nov 24, 2011, 5:38 AM
B M SuchitraPosted Nov 24, 2011, 4:59 AM
I had the same thing in mind but i have not used out parameters.. Could you please help me out with the coding.
I am using VS2008
strColumnName has names of all the columns in the table and strColumnValues has all the values of the columns to be saved in the table.
VulpesPosted Nov 24, 2011, 4:42 AM
To my mind, #3 and #4 are cleaner than the other solutions.