Home > Back-end >  TDBGridEh fields in content cannot be changed, consult, the following figure
TDBGridEh fields in content cannot be changed, consult, the following figure

Time:11-16

CodePudding user response:

At the same time there is a future generations the pick button script as follows, also can't do change
Procedure TForm3. Btn4Click (Sender: TObject);
The begin
With qryvoucher do
The begin
Try
DisableControls;
If (not isempty) then
The begin
First;
While not eof do
The begin
Edit;
FieldByname (' IsSelect). AsBoolean:=not FieldByname (' IsSelect). AsBoolean;
Next;
end;
end;
The finally
EnableControls;
End
end;
end;

CodePudding user response:

Are you directly connect to the database, or C/S,
When I was in use DBGridEh, not encountered this kind of situation,
Whether to set the character as read-only "isSelect"?

CodePudding user response:

C/S, set the IsSelect. Readonly:=false

CodePudding user response:

Click can remove the hook, for sure, but all focus in to the downside, the change is invalid, at the same time with a button to process the hook or not hook is also unable to change the actual content of the dataset

CodePudding user response:

Carefully check the data table DBGridEh events, is likely to be affected each other, or see the various events of ADO,
And what is the function called process, there is likely to affect the operation of click effect,
Not really set up KeyPreview try, but this seems to be no sense,

CodePudding user response:

Also, try to DisableControls take out, I found in the application, and sometimes this can affect the operation,

CodePudding user response:

The DATASource or has an attribute in the DataSet is AutoEdit
You should not set to TRUE
But the edit mode is very dangerous

CodePudding user response:

Can also own processing BeforeScroll event, add the corresponding judgement and Post operation

Yourself to deal with, though not so save worry save trouble, but the benefits are all their mastery

CodePudding user response:

1, check the DBGridEh related events, if there is a conflict,
2, this kind of circumstance is generally DBGridEh dataset not card, Edit mode appropriate event to add, Edit, try,

CodePudding user response:

The building should be used the real database field, such as computing field or isSelect=a.S well such fields

CodePudding user response:

Procedure TForm3. Btn4Click (Sender: TObject);
The begin
With qryvoucher do
The begin
Try
DisableControls;
If (not isempty) then
The begin
First;
While not eof do
The begin
Edit;
FieldByname (' IsSelect). AsBoolean:=not FieldByname (' IsSelect). AsBoolean;
Post;//====================
Next;
end;
end;
The finally
EnableControls;
End
end;
end;

CodePudding user response:

Less a POST???????

CodePudding user response:

Ever, go on

CodePudding user response:

I have a very practical solution, for your reference about the
https://mp.csdn.net/postedit/86216084

CodePudding user response:

First to see if your field type int or bit, also want to see the picklist set corresponding value, usually 0 and 1