I'm a little puzzled on why does the Substring() function not working properly. It just won't chopped off the comma at the end of the string.
See example code below...
public static string OrderByClauseBuilder(string parmSortByColumn)
{
if (parmSortByColumn.LastIndexOf(",") > -1) {
parmSortByColumn.Substring(0, parmSortByColumn.LastIndexOf(","));
}
return parmSortByColumn;
}
protected void Page_Load(object sender, EventArgs e)
{
string sqlAsk = "";
string value = "stocknumber asc,";
sqlAsk = OrderByClauseBuilder(value);
}