How to insert DEFAULT?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
to2
Posts: 4
Joined: Wed 10 Dec 2014 10:08

How to insert DEFAULT?

Post by to2 » Mon 19 Jan 2015 14:55

I'm using a TUniQuery Component and I'm able to construct an SQL command string to insert new data to a table. Now I'm testing TUniQuery::SQLInsert and fields to prevent me from building commands on string level. As I have found out field names have to be defined in the TUniQuery::SQLInsert::Text and their values have to be set before a TUniQuery::Post is called.

Sometimes I want to set a value for the field but in other situations I would like the database set their default value for it. In other words I'd like to pass a DEFAULT then. How can I do this without altering the TUniQuery::SQLInsert::Text?

FCS
Posts: 176
Joined: Sat 23 Feb 2013 18:46

Re: How to insert DEFAULT?

Post by FCS » Mon 19 Jan 2015 18:36

Hello,

Did you try ?

UQ.Options.DefaultValues:=true;

Regards
Michal

to2
Posts: 4
Joined: Wed 10 Dec 2014 10:08

Re: How to insert DEFAULT?

Post by to2 » Tue 20 Jan 2015 09:33

Did you try ? UQ.Options.DefaultValues:=true;
Saw it, but didn't try. I was looking for a field property DEFAULT. But this global Options.DefaultValues is the better approach. I have to fill known values only and unknown are set by DBMS. I've tried it - works fine.

Thx

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: How to insert DEFAULT?

Post by azyk » Wed 21 Jan 2015 09:58

It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about UniDAC.

Post Reply