How can i trim or remove " , " at the end of my query?

Posted by Phsika on Stack Overflow See other posts from Stack Overflow or by Phsika
Published on 2010-06-14T10:35:10Z Indexed on 2010/06/14 10:42 UTC
Read the original article Hit count: 118

i try to write a query but my query finished with "Control nvarchar(500), ". i want to finish "Control nvarchar(500)" How can remove ",", " "?

 void SqlTable(List listMyColumnNames, string TableName)
        {

            string  Text = "Create table ENG_"+TableName+" (ENG_"+TableName+"_ID integer PRIMARY KEY identity(1,1), ";
            char[] MyChar = {',', ' ' };
            for (int i = 0; i < listMyColumnNames.Count; )
            {
                 Text+=listMyColumnNames[i]+" nvarchar(500), ";
                 if (i == listMyColumnNames.Count-1)
                     Text.TrimEnd(MyChar);
                 i++;
            }
            Text+=" )";

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET