Problems with TMSQuery and ProviderFlags
Problems with TMSQuery and ProviderFlags
I have a problem making persistents the fields of the query.
The problem it's that the query not recognize when the field is the primary key and required.
pfInkey and required state in false (not change to true)
The problem it's that the query not recognize when the field is the primary key and required.
pfInkey and required state in false (not change to true)
Table
------
exec sp_addtype IDTabla, "integer", "NULL"
go
exec sp_addtype Descripcion40, "varchar(40)", "NULL"
go
exec sp_addtype CodigoHumano, "varchar(20)", "NOT NULL"
go
CREATE TABLE Areas (
Area_ID IDTabla NOT NULL,
Codigo CodigoHumano,
Descripcion Descripcion40
)
go
ALTER TABLE Areas
ADD PRIMARY KEY CLUSTERED (Area_ID ASC)
go
Query
-------
SELECT *
FROM
Areas
TMSQuery (from DFM)
PS: Today change Options.RequiredFields = True and "fields required" are retrieve but not pfInkey
-----------
object qryAreas: TMSQuery
Connection = rdmLoJackMain.dbLoJack
SQL.Strings = (
'SELECT *'
'FROM'
' Areas')
UniDirectional = True
FetchAll = False
Options.RequiredFields = True
Left = 48
Top = 16
object qryAreasArea_ID: TIntegerField
FieldName = 'Area_ID'
Origin = 'Areas.Area_ID'
end
object qryAreasCodigo: TStringField
FieldName = 'Codigo'
Origin = 'Areas.Codigo'
end
object qryAreasDescripcion: TStringField
FieldName = 'Descripcion'
Origin = 'Areas.Descripcion'
Size = 40
end
object qryAreasNotas: TStringField
FieldName = 'Notas'
Origin = 'Areas.Notas'
Size = 240
end
end
PS: Iam speak spanish only, sorry for my english
------
exec sp_addtype IDTabla, "integer", "NULL"
go
exec sp_addtype Descripcion40, "varchar(40)", "NULL"
go
exec sp_addtype CodigoHumano, "varchar(20)", "NOT NULL"
go
CREATE TABLE Areas (
Area_ID IDTabla NOT NULL,
Codigo CodigoHumano,
Descripcion Descripcion40
)
go
ALTER TABLE Areas
ADD PRIMARY KEY CLUSTERED (Area_ID ASC)
go
Query
-------
SELECT *
FROM
Areas
TMSQuery (from DFM)
PS: Today change Options.RequiredFields = True and "fields required" are retrieve but not pfInkey
-----------
object qryAreas: TMSQuery
Connection = rdmLoJackMain.dbLoJack
SQL.Strings = (
'SELECT *'
'FROM'
' Areas')
UniDirectional = True
FetchAll = False
Options.RequiredFields = True
Left = 48
Top = 16
object qryAreasArea_ID: TIntegerField
FieldName = 'Area_ID'
Origin = 'Areas.Area_ID'
end
object qryAreasCodigo: TStringField
FieldName = 'Codigo'
Origin = 'Areas.Codigo'
end
object qryAreasDescripcion: TStringField
FieldName = 'Descripcion'
Origin = 'Areas.Descripcion'
Size = 40
end
object qryAreasNotas: TStringField
FieldName = 'Notas'
Origin = 'Areas.Notas'
Size = 240
end
end
PS: Iam speak spanish only, sorry for my english

Login Guest
I request excuses, in the previous message even I not login how MrFloyd
Code: Select all
var
MSQueryMIDAS: TMSQuery;
MSProv: TDataSetProvider;
ClientDataSet1: TClientDataSet;
MSQueryMIDAS := TMSQuery.Create(Self);
MSProv := TDataSetProvider.Create(Self);
ClientDataSet1 := TClientDataSet.Create(Self);
with MSQueryMIDAS do
begin
Name := 'MSQueryMIDAS';
Connection := MSConnectionSDACTest;
end;
with MSProv do
begin
Name := 'MSProv';
DataSet := MSQueryMIDAS;
Options := [poAllowCommandText];
end;
with ClientDataSet1 do
begin
Name := 'ClientDataSet1';
CommandText := 'SELECT * FROM test..AREAS';
ProviderName := 'MSProv';
end;
ClientDataSet1.Open;
Caption := BoolToStr(pfInKey in ClientDataSet1.Fields[0].ProviderFlags, True);