• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

is there anyway to set a specific field of a dataset editable

I'm using
   DataSource1.DataSet.Edit;
to set my fields to editable.

A situation has come up where I would like to set a specific field in my table to editable and none of the other ones is this possible and how do I do it?  

So something like
DataSource1.DataField('Fieldname').Edit
0
ICPooreman
Asked:
ICPooreman
1 Solution
 
TheRealLokiSenior DeveloperCommented:
you can set "ReadOnly" to true on each field
so in your case, you could set them all to false except the one you want to edit
0
 
JDSkinnerCommented:
Hi
Try
procedure TForm1.FormCreate(Sender: TObject);
var iCounter: integer;
    iEditColumn: integer;
begin
    iEditColumn:= 3; // any column to be edited
    for iCounter := 0 to (DBGrid1.Columns.Count-1) do
    begin
        if iCounter <> iEditColumn then DBGrid1.Columns[iCounter].ReadOnly:= true;
    end;
end;
0
 
sun4sundayCommented:
or you can do it with enable and disable to component like DBEdit. Once it disable, the user cannot edit on that field.
Make disable/Enable depends on the criteria you need.

sun4sunday
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now