OleDbCommandBuilder improvement

  • Thread starter Thread starter Samuel
  • Start date Start date
S

Samuel

Hello again:

I think in the next version of the .NET Framework, OleDbCommandBuilder
should use square brackets when generating commands for column names with
spaces.

UPDATE [My Column] column2 [Column 3] ... ...

Otherwise it throws an OleDbException "Incorrect SQL statement sintax" when
calling dataAdapter.Update();

Maybe other command builders have the same problem.
Column names with spaces are rarely used, but possible.
That's all. Thank you.

Samuel. (from Spain)
 
Hi Samuel

I recently had exactly the same problem, except that I was inadvertently
using a reserved word (password) as a column name rather than using spaces
in the name. The effect is the same though. I had incorrectly assumed that
the default would be to use [ and ] in such cases, but it is not.

In my case, I would prefer consistency between DBMS and provider, so that if
the DBMS (Access in my case) allows a column name to be used, then the
command builder works without special treatment. Also, I found that
DataTable and DataRow operations worked as expected whilst the command
builder operation did not. That is not consistent behaviour.

Regards

Charles
 
Again, do yourself a BIG favor and get rid of the spaces in object names.
There are many places where this will cause you grief.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top