[fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

Marcos Douglas md at delfire.net
Wed Mar 21 13:31:23 CET 2012


On Wed, Mar 21, 2012 at 5:01 AM,  <michael.vancanneyt at wisa.be> wrote:
>
>
> On Tue, 20 Mar 2012, Marcos Douglas wrote:
>
>> On Tue, Mar 20, 2012 at 8:12 PM,  <michael.vancanneyt at wisa.be> wrote:
>>>
>>>
>>>
>>> On Tue, 20 Mar 2012, Marcos Douglas wrote:
>>>
>>>> On Tue, Mar 20, 2012 at 6:59 PM, Michael Van Canneyt
>>>> <michael at freepascal.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, 20 Mar 2012, Marcos Douglas wrote:
>>>>>
>>>>>>
>>>>>> No.
>>>>>> Anyway, I change the colum names (id,name to col1, col2)
>>>>>> The error is:
>>>>>> "Cannot insert the value NULL into column 'col', table
>>>>>> tempdb.dbo.#t..."
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> This error has nothing to do with FPC or SQLDB.
>>>>>
>>>>> Your SQL statement is trying to insert NULL in a required field.
>>>>
>>>>
>>>>
>>>> No Michael, see the example I wrote before.
>>>
>>>
>>>
>>> I saw the example :-)
>>>
>>>
>>>>
>>>> Create table:
>>>> create table #t (col1 int, col2 varchar(60))
>>>>
>>>> OBS: No column is required.
>>>>
>>>> This INSERT works:
>>>> insert into #t values (1, 'bla bla bla')
>>>>
>>>> This INSERT do NOT works:
>>>> insert into #t (col2) values ('bla bla')
>>>
>>>
>>>
>>> This kind of SQL is passed as-is to MSSQL. To my knowledge, SQLDB does
>>> not
>>> change it.
>>>
>>> If you had been using parameters, it would have been a different story.
>>
>>
>> Does matter if I use or not parameters.
>
>
> Yes, of course. In that case, SQLDB does some preprocessing of your SQL
> statement.
>
> This can easily be checked. Try setting ParamCheck to 'False' before
> executing your statement.

I don't have such problem because I have my own SQLdb wrapper and
params works a bit different.
Anyway, thanks (and sorry) for your time for help me.

Best regards,
Marcos Douglas



More information about the fpc-devel mailing list