Home > Back-end >  How to write the value of the checkbox in the dbgrideh to the table
How to write the value of the checkbox in the dbgrideh to the table

Time:09-30

What I use is dbgrideh + ADOQuery
Has built a table, at the same time the CHK fields corresponding to the checkbox,
KeyList take 1, 0
In event DBGridEh1CellClick code for
If (Column. FieldName='CHK) then the begin
If ADOQuery1. FieldByName (' CHK) AsString='0' then
The begin
ADOQuery1. Edit;
ADOQuery1. FieldByName (' CHK). AsString:='1';
ADOQuery1. Post;
End the else
The begin
ADOQuery1. Edit;
ADOQuery1. FieldByName (' CHK). AsString:='0';
ADOQuery1. Post;
end;
But I found the data in the table of CHK values, always be 0
Excuse me why?

CodePudding user response:

You directly into a bool type CHK, you don't have to write code yourself to switch the state

CodePudding user response:

Use the Boolean field type

CodePudding user response:

1, no Boolean fields in SQL table
2, my ultimate goal is to think through judging CHK update other fields (such as name), have what good method, to code, use adoquery, thank you

CodePudding user response:

reference woaichina reply: 3/f
1, SQL table without the Boolean fields
2, my ultimate goal is to think through judging CHK update other fields (such as name), have what good method, to code, use adoquery, thank you

The types of bit in SQL is the Boolean type
  • Related