Default value error with schema

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Tomasz Andrzejewski
Posts: 14
Joined: Fri 30 Dec 2011 15:11

Default value error with schema

Post by Tomasz Andrzejewski » Sat 24 Nov 2012 20:10

Hello,

If I create table for specific schema (different from dbo) on MSSQL Server wit default value I get error due post e.g

Code: Select all

CREATE SCHEMA [hub]
GO

CREATE TABLE [hub].[Test](
  TestId int not null identity(1,1),
  Name [nvarchar](100),
  CreateDate datetime not null default getdate()
)
GO
and now delphi code:

Code: Select all

procedure TForm.ButtonClick(Sender: TObject);
var
  UniQuery1: TUniQuery;
begin
  UniQuery1 := TUniQuery.Create(Self);
  try
    UniQuery1.Connection := UniConnection;
    UniQuery1.SQL.Add('select * from [hub].[Test] where 1 = 0');
    UniQuery1.Options.DefaultValues := True;
    UniQuery1.Open;
    UniQuery1.Append;
    UniQuery1.FieldByName('Name').Value := 'some data';
    UniQuery1.Post;
  finally
    FreeAndNil(UniQuery1);
  end;
end;
If I use ADOConnection and ADOQuery from dbGO there is no error.

AndreyZ

Re: Default value error with schema

Post by AndreyZ » Mon 26 Nov 2012 10:10

Thank you for the information. We have reproduced and fixed this problem. This fix will be included in the next UniDAC build.

Post Reply