Problem with property DefaultValues of TMSQuery
Posted: Sat 19 Jan 2008 15:13
Dear Support,
I use last version SDAC 4.X ver. professional with CodeGear Delphi 2007 prof. with last service packs and MS SQL 2005 Express edition with service pack 2 in italian.
I create a simple DB with this table :
CREATE TABLE [dbo].[MASTER] (
[CODICE] int IDENTITY(1, 1) NOT NULL,
[ESENTE] bit DEFAULT 0 NOT NULL,
[RAGSOC] varchar(30) COLLATE Latin1_General_CI_AS NULL,
[UTENTE] varchar(30) COLLATE Latin1_General_CI_AS DEFAULT user_name() NULL,
[ULTMOD] datetime DEFAULT getdate() NULL,
CONSTRAINT [MASTER_pk] PRIMARY KEY CLUSTERED ([CODICE]),
UNIQUE ([CODICE])
)
With Delphi I create a simple project with a TMSConnection, TMSQuery,TDatasource,TDBNavigator and a TDBGrid .
I set with MSQuery editor SQL property : select * from master and SQLINsert :
INSERT INTO master
(ESENTE, RAGSOC, UTENTE, ULTMOD)
VALUES
(:ESENTE, :RAGSOC, :UTENTE, :ULTMOD)
SET :CODICE = SCOPE_IDENTITY()
After this I set options - DefaultValues of TMSQuery - equal true and compile my project.
When I press insert button on DBNavigator I obtain an error message :
- '(getdate())' is not a valid date and time -
I see in edit fields editor of TMSQuery component that :
Default Expression of esente field is : true.
Default Expression of ultmod field is : getdate().
Default Expression of utente field is : username().
Is this correct ?
Why default expression of esente field is equal true ? I set in DB equal false to default value.
Why I obtain an error message on funtion getdate() ?
Best regards.
Sergio Bertolotti
I use last version SDAC 4.X ver. professional with CodeGear Delphi 2007 prof. with last service packs and MS SQL 2005 Express edition with service pack 2 in italian.
I create a simple DB with this table :
CREATE TABLE [dbo].[MASTER] (
[CODICE] int IDENTITY(1, 1) NOT NULL,
[ESENTE] bit DEFAULT 0 NOT NULL,
[RAGSOC] varchar(30) COLLATE Latin1_General_CI_AS NULL,
[UTENTE] varchar(30) COLLATE Latin1_General_CI_AS DEFAULT user_name() NULL,
[ULTMOD] datetime DEFAULT getdate() NULL,
CONSTRAINT [MASTER_pk] PRIMARY KEY CLUSTERED ([CODICE]),
UNIQUE ([CODICE])
)
With Delphi I create a simple project with a TMSConnection, TMSQuery,TDatasource,TDBNavigator and a TDBGrid .
I set with MSQuery editor SQL property : select * from master and SQLINsert :
INSERT INTO master
(ESENTE, RAGSOC, UTENTE, ULTMOD)
VALUES
(:ESENTE, :RAGSOC, :UTENTE, :ULTMOD)
SET :CODICE = SCOPE_IDENTITY()
After this I set options - DefaultValues of TMSQuery - equal true and compile my project.
When I press insert button on DBNavigator I obtain an error message :
- '(getdate())' is not a valid date and time -
I see in edit fields editor of TMSQuery component that :
Default Expression of esente field is : true.
Default Expression of ultmod field is : getdate().
Default Expression of utente field is : username().
Is this correct ?
Why default expression of esente field is equal true ? I set in DB equal false to default value.
Why I obtain an error message on funtion getdate() ?
Best regards.
Sergio Bertolotti