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).
[quoted text, click to view] Rob R. Ainscough wrote:
> 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.
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.
[quoted text, click to view] <zackary.evans@gmail.com> wrote in message
news:1154377851.438441.110530@75g2000cwc.googlegroups.com...
> 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).
>
>
>
> Rob R. Ainscough wrote:
>> 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.
>