how to post a query with default value field?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sefeng1982
Posts: 2
Joined: Thu 22 Jul 2010 10:35

how to post a query with default value field?

Post by sefeng1982 » Fri 25 Feb 2011 05:44

hello,erveryone~
i met a problem about post a query.
questiontable has the follow column:
code identity(1,1)
question_id int not null
question_name varchar(500) not null
description varchar(500) null
ztime datetime default(getdate()) not null
status bit default(1) not null

here is the component:
selectuniquery.sql.text:='select * from questiontable'
selectuniquery.updateobject:=uniupdatesql;
updatesql.insertobject:=insertuniquery;
insertuniquery.sql.text:='insert into questiontable (quesion_id,quesiton_name) values (:quesiont_id,:question_name)'

selectuniquery.append;
selectuniquery.fieldbyname('question_id'):='1';
selectuniquery.fieldbyname('question_name'):='question1';
selectuniquery.post;

the error is field ztime must has value ~~~
how can i post the dataset ?

sorry for my poor english~~

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 25 Feb 2011 09:02

hello,

To resolve the problem you should set the RequiredFields property to false like:

UniQuery.Options.RequiredFields := false;

Post Reply