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


VulpesRank #55 · 29.2K reputationPosted Nov 23, 2011, 11:42 PM EST
To my mind, #3 and #4 are cleaner than the other solutions.
B M SuchitraRank #2,922 · 492 reputationPosted Nov 23, 2011, 11:59 PM EST
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.
VulpesRank #55 · 29.2K reputationPosted Nov 24, 2011, 12:38 AM EST