Delphi 2007 for Win32 Version 11.0.2804.9245
Windows Vista Build 6002 SP2
Microsoft SQL-Server 2005
We have a problem with a CreateAndFillParamAccs error message which allways appears in the following scenario:
Step 1:
Insert a new record into a ClientDataSet which will create a error if it is applied.
Code: Select all
// Insert a new record without providing a value for the NOT NULL column
cdsTest.Append;
cdsTestTestID.Value := -1;
cdsTestDataRequired.Clear;
cdsTestDataOptional.Value := 'some data';
cdsTest.Post;
// This will show the expected NOT NULL error
cdsTest.ApplyUpdates(0);
Step 2:
Correct the error by entering the missing value and call ApplyUpdates again.
Code: Select all
// provide the missing value
if cdsTest.Locate('TestId', -1, []) then
begin
cdsTest.Edit;
cdsTestDataRequired.Value := 'more data';
cdsTest.Post;
end;
// This shows the CreateAndFillParamAccs Error
cdsTest.ApplyUpdates(0);
procedure CreateAndFillParamAccs already called (OLEDBAccess.pas, line 5666)
Step 3:
Dont change anything and just call ApplyUpdates again.
Code: Select all
cdsTest.ApplyUpdates(0)
The table used for the above steps has been created like this:
Code: Select all
-- Create a simple test table
IF Object_ID('TestTbl') IS NOT NULL
DROP TABLE TestTbl
CREATE TABLE TestTbl
(
TestID int IDENTITY(1,1) NOT NULL,
DataRequired VARCHAR(15) NOT NULL,
DataOptional VARCHAR(15) NULL
CONSTRAINT PK_TestTbl PRIMARY KEY
(
TestID ASC
)
)