How can i use ListDictionary like List my sample codes below real codes is last one.
for (int i = 0; i < listMyColumnNames.Count; )
{
if (i < listMyColumnNames.Count - 1) ---> this is important
Text += ", ";
i++;
}
how can i do with ListDictionary.
int QuantityInt;
double QuantityDouble;
ListDictionary ld = new ListDictionary();
foreach (DataColumn dc in dTable.Columns)
ld.Add(dc.ColumnName, dTable.Rows[0][dc].ToString());
foreach (string ky in ld.Keys)
if (int.TryParse(ld[ky].ToString(), out QuantityInt))
ld[ky] = "integer";
else if(double.TryParse(ld[ky].ToString(), out QuantityDouble)
ld[ky]="double";
else
ld[ky]="nvarchar";
void CreatSqlTable(ListDictionary ldColumns ,List<string> listMyColumnNames, string TableName, string MaxCharacterValue)
{
string Text = "Create table ENG_" + TableName + " (ENG_" + TableName + "_ID integer PRIMARY KEY identity(1,1), ";
for (int i = 0; i < listMyColumnNames.Count; )
{
Text += "[ENG_" + TableName + "_" + listMyColumnNames[i].Replace(' ', '_').Replace("_-_", "_").ToUpper(CultureInfo.InvariantCulture)+ "] nvarchar("+MaxCharacterValue+") ";
if (i < listMyColumnNames.Count - 1)
Text += ", ";
i++;
}