Try changing the format this way.
griData.DefaultView.Sort = string.Format("[{0}] {1}", orderByField, sortDirection)
A common way to handle reserved column names is to enclose the name in square brackets.
EDIT I cannot find a workaround for this case. (Of course, this is a bad decision to have such names, but to be honest, I was convinced that the square brackets could handle this)
The only possible solution found so far is to somehow modify your query by creating an alias for your column names, and then you can sort for those aliases. Something like that
SELECT Period,
[city1,state] AS City1State,
[city2,state] AS City2State,
[city3,state] AS City3State
FROM yourTable
....
orderByField = "City1State"
sortDirection = "DESC"
griData.DefaultView.Sort = string.Format("{0} {1}", orderByField, sortDirection)
, , Sort DataView, , . . , , .
DataView.....
internal unsafe IndexField[] ParseSortString(string sortString)
{
string str;
int num;
int num2;
string[] strArray;
IndexField[] fieldArray;
DataColumn column;
bool flag;
char[] chArray;
fieldArray = zeroIndexField;
if (sortString == null)
{
goto Label_011A;
}
if (0 >= sortString.Length)
{
goto Label_011A;
}
strArray = sortString.Split(new char[] { 0x2c });
fieldArray = new IndexField[(int) strArray.Length];
num2 = 0;
goto Label_0111;
Label_0041:
str = strArray[num2].Trim();
num = str.Length;
flag = 0;
if (num < 5)
{
goto Label_007D;
}
if (string.Compare(str, num - 4, " ASC", 0, 4, 5) != null)
{
goto Label_007D;
}
str = str.Substring(0, num - 4).Trim();
goto Label_00A7;
Label_007D:
if (num < 6)
{
goto Label_00A7;
}
if (string.Compare(str, num - 5, " DESC", 0, 5, 5) != null)
{
goto Label_00A7;
}
flag = 1;
str = str.Substring(0, num - 5).Trim();
Label_00A7:
if (str.StartsWith("[", 4) == null)
{
goto Label_00DE;
}
if (str.EndsWith("]", 4) == null)
{
goto Label_00D5;
}
str = str.Substring(1, str.Length - 2);
goto Label_00DE;
Label_00D5:
throw ExceptionBuilder.InvalidSortString(strArray[num2]);
Label_00DE:
column = this.Columns[str];
if (column != null)
{
goto Label_00F7;
}
throw ExceptionBuilder.ColumnOutOfRange(str);
Label_00F7:
*(&(fieldArray[num2])) = new IndexField(column, flag);
num2 += 1;
Label_0111:
if (num2 < ((int) strArray.Length))
{
goto Label_0041;
}
Label_011A:
return fieldArray;
}