Discussion:
ClientDataSet Post fails with "Field must have a value"
(too old to reply)
Jan Doggen
2008-01-29 12:59:32 UTC
Permalink
This TClientDataSet 'Post' fails
with "Field 'Task' must have a value':

with dmViseTools.cdsUserAccess do begin
Insert;
{ These are the four fields in table UserAccess, they need updating: }
FieldByName('UA_User_ID').AsInteger := UserID;
FieldByName('UA_Task_ID').AsInteger := TaskID;
FieldByName('UA_Level_ID').AsInteger := LevelID;
FieldByName('UA_Lang_ID').AsInteger := LangID
Post;
end; { with dmViseTools.cdsUserAccess }

This is the underlying TSQLQuery:

SELECT
A.UA_User_ID,A.UA_Task_ID,A.UA_Level_ID,A.UA_Lang_ID,T.Task_Descrip as
Task,L.Level_Descrip as Level,Language=
CASE T.Task_HasLanguages
WHEN 1 THEN G.Lang_Name
ELSE 'n/a'
END
FROM UserAccess A, UserTasks T, UserLevels L, Languages G
where A.UA_User_ID=:UID
and A.UA_Task_ID=T.Task_ID
and A.UA_Level_ID=L.Level_ID
and A.UA_Lang_ID=G.Lang_ID

Table UserAccess does not have a primary key or indices, the values I
insert are not duplicates.
I have been messing with the provider UpdateMode and the ProviderFlags
of the query FieldDefs, but I can't get it to work.
Who can push me in the right direction?

Thanks
Jan
Craig Stuntz [TeamB]
2008-01-29 13:13:59 UTC
Permalink
'Task' here is the TField.DisplayName. Look at which field(s) this
could possibly map to.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
All the great TeamB service you've come to expect plus (New!)
Irish Tin Whistle tips: http://learningtowhistle.blogspot.com
Jan Doggen
2008-01-30 06:31:28 UTC
Permalink
Post by Craig Stuntz [TeamB]
'Task' here is the TField.DisplayName. Look at which field(s) this
could possibly map to.
That's the T.Task_Descrip as Task in the query
This is a lookup field from another table
I don't want these updates, only the 4 UA_... fields that come from table
Useraccess

Bye
Jan
TProgrammer
2008-01-30 09:09:04 UTC
Permalink
Post by Jan Doggen
I have been messing with the provider UpdateMode and the ProviderFlags
of the query FieldDefs, but I can't get it to work.
Who can push me in the right direction?
Thanks
Jan
Set Required=False in the field giving the error.
Jan Doggen
2008-01-30 08:37:20 UTC
Permalink
Post by TProgrammer
Post by Jan Doggen
I have been messing with the provider UpdateMode and the ProviderFlags
of the query FieldDefs, but I can't get it to work.
Who can push me in the right direction?
Thanks
Jan
Set Required=False in the field giving the error.
That's one of those "Hey I didn't know" things ;-)
I had already resorted to assigning the three looked up field a value *in
the clientdataset*. After all this was an Insert so I can understand them
needing values in the new record.
But after that I got into trouble with the infamous Translation Capacity
Exceeded error, so I have now gone back to my old method of using
TClientDataSets only for displaying data in TDBGrids, and handling all
other updates/lookups through pure SQL.

Thanks
Jan
TProgrammer
2008-01-30 14:12:32 UTC
Permalink
Post by Jan Doggen
But after that I got into trouble with the infamous Translation Capacity
Exceeded error
What's that?
Jan Doggen
2008-01-31 18:09:53 UTC
Permalink
That's an entirely new species! ;-)))

I meant: Transaction capacity exceeded

Bye
jan
Post by TProgrammer
Post by Jan Doggen
But after that I got into trouble with the infamous Translation Capacity
Exceeded error
What's that?
Loading...