Bug #13036 Returns error when field names contain any of the following chars %<>()/ etc
Submitted: 7 Sep 2005 12:52 Modified: 23 Sep 2005 15:40
Reporter: Rob Cairns Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.5 OS:Windows (Windows XP Professional)
Assigned to: Reggie Burnett CPU Architecture:Any

[7 Sep 2005 12:52] Rob Cairns
When field names have special characters - update returns an error

How to repeat:
Use a field name containing any of the following characters : ()%<>/

Suggested fix:
Here is my quick and dirty fix in CommandBuilder.cs:
                          private static string GetParameterName(string columnName)
			string colName = columnName.Replace(" ", "");
			//Rob Cairns
			colName = colName.Replace("/", "_per_");
			colName = colName.Replace("-", "_");
			colName = colName.Replace(")", "_cb_");
			colName = colName.Replace("(", "_ob_");
			colName = colName.Replace("%", "_pct_");
			colName = colName.Replace("<", "_lt_");
			colName = colName.Replace(">", "_gt_");
			colName = colName.Replace(".", "_pt_");
			return colName;
[14 Sep 2005 16:56] Reggie Burnett

Thanks for the bug report and the patch.  I took your code and used it (tweaked to use StringBuilder).  It may feel like a quick and dirty hack but it actually works pretty well.  The problem is that the TokenizeSql routine I have stops when it sees a nonalphanumeric.  This could be changed but the tokenizer would never be able to support ) in the paramter name since ) also terminates the list of parameters.  Using this technique you can use ) in your field name.  Not sure why you would though... :-)
[15 Sep 2005 18:21] Mike Hillyer
Added to 1.0.6 changelog:

<listitem><para>Field names that contained the following characters caused errors: <literal>()%&lt;&gt;/</literal> (Bug #13036)</para></listitem>