GetInsertCommand problems...

  • Thread starter Thread starter Rob R. Ainscough
  • Start date Start date
R

Rob R. Ainscough

I've noticed that the OleDbCommandBuilder.GetInsertCommand often produces
incorrect syntax which will generate errors. I've had to override and
provide my own commands. Specifically the GetInsertCommand seems to have
issues when dealing with "reserved" words -- as in a field name "Note" -- it
will not generate the correct syntax -- should be "[Note]" in the string.

Is this a lack of completeness on Microsoft's part or is this "by design"?
It would seem to me that if the purpose of GetInsertCommand is to save the
developer time, but the developer can't rely on the accuracey of the method,
then the developer is back at square one? I'm not going to use a method
that I know will produce incorrect syntax in certain situations -- I'll just
use a more reliable approach (aka I'll code it).

Rob.
 
Just a guess but since the reserved keywords are specific to the type
of database and the actual database type is transparent to the
OleDbConnection object (via the OLE provider), how is the command
builder supposed to guess what keywords to generate the correct syntax
for?

If you are using a SqlServer or Oracle database, you can use their
specific command builders without a problem (at least I have).
 
The connection is provided so the CommandBuilder does have all the
information it needs. But regardless, why have a command builder at all if
you can't rely on the what it builds? You see my point, half implemented
just doesn't cut it nor does it make development work faster/easier -- just
causes more R&D.

100% Managed code is the goal.


Just a guess but since the reserved keywords are specific to the type
of database and the actual database type is transparent to the
OleDbConnection object (via the OLE provider), how is the command
builder supposed to guess what keywords to generate the correct syntax
for?

If you are using a SqlServer or Oracle database, you can use their
specific command builders without a problem (at least I have).


I've noticed that the OleDbCommandBuilder.GetInsertCommand often produces
incorrect syntax which will generate errors. I've had to override and
provide my own commands. Specifically the GetInsertCommand seems to have
issues when dealing with "reserved" words -- as in a field name "Note" --
it
will not generate the correct syntax -- should be "[Note]" in the string.

Is this a lack of completeness on Microsoft's part or is this "by
design"?
It would seem to me that if the purpose of GetInsertCommand is to save
the
developer time, but the developer can't rely on the accuracey of the
method,
then the developer is back at square one? I'm not going to use a method
that I know will produce incorrect syntax in certain situations -- I'll
just
use a more reliable approach (aka I'll code it).

Rob.
 
Back
Top