Board index » delphi » Paradox locked record - need to unlock

Paradox locked record - need to unlock

I have a program that has a Table of names and addresses (Table_Names)
displayed in a DBGrid (DBGrid_Names). This form is used to create
transactions on about 300 families. Occasionally, I need to edit a set
of
Family data or add a set of Family data. I have an additional form that
is
called from the MainMenu. I can call this additional form for Editing or

Adding New Family data. In either case I then need to write this data to

Table_Names (Paradox file, Cogs_Names.DB). The DBGrid displays
only two fields of the 15 fields in Table_Names. I When I call the
additional Form for editing, the data from the active fields in the
DBGrid
are displayed in the editing Form. So far, so good. When I edit any of
the
15 fields and try to Post, I get a message that says the Paradox file is
in
use by another user, which is me. I know this is a characteristic of
Paradox files but this is a single user program. I need to be able to
edit
the data in the Table_Names. After editing or adding Family data, the
 Form is closed and the original Form is again fully visible and the
operation continues.

How can I overcome the Paradox record locking?

Merv Norton
MLNor...@earthlink.net

 

Re:Paradox locked record - need to unlock


Just call the Post method of the TTable that is editing the record.

--
Bill

Re:Paradox locked record - need to unlock


Unless you've accidentally set exclusive to true for the table, that
should not happen.   The only time it should happen is when you and
another user (or another instance) are both editing the *same* record
in the same table.   You should be able to edit a record even if
another user is viewing it, so long as they are not actually editing
it.   If table.exclusive is correctly set to false, then I suspect
your problem has something to do with a master/detail relationship.

On Mon, 13 Nov 2000 19:22:58 -0500, "Mervin L. Norton"

Quote
<MLNor...@earthlink.net> wrote:
>I have a program that has a Table of names and addresses (Table_Names)
>displayed in a DBGrid (DBGrid_Names). This form is used to create
>transactions on about 300 families.

<details snipped>

Re:Paradox locked record - need to unlock


After a little more thought and seeing Bill Todd's answer, it occurred
to me that maybe the table is being put into edit mode when you select
the record from the DBGrid.  This is all guesswork without seeing the
code but perhaps you need to set dgEditing to false in the DBGrid's
"Options" property.

Otherwise, if you are using the same instance of the table for the
grid and the editing form, then as Bill said you may just have to call
Post in the editing form rather than Edit and Post.

On Tue, 14 Nov 2000 01:21:05 GMT, <nomail.please> (Colin Acheson)
wrote:

Quote
>Unless you've accidentally set exclusive to true for the table, that
>should not happen.

Re:Paradox locked record - need to unlock


My problem remains unsolved.

The following information may help you with a solution.

Table_Names
  Active = True;
  Exclusive = True

DBGrid_Names
  Enabeled = True
  dbEditing = False

The following is the Procedure in my main Form that
contains the Table_Names and DBGrid_Name that calls
the edit form, Form_Family.

procedure TForm_Cogs_Data.Family_EditClick(Sender: TObject);
begin
  with Form_Family do
  begin
    Label_Title.Caption := 'Edit Family Data';
    Label_Title.Left := 175;
    Label_Title.Font.Color := clRed;
    Show;
  end;
end;

The following is the Posting Procedure in the edit form, Form_Family.
procedure TForm_Family.BitBtn_PostClick(Sender: TObject);
var
  TempStr1:  string;
  TempStr2:  string;
  blanks:    string;
  ID:        string;
begin
  with Form_Cogs_Data.Table_Names do
  begin
    Edit;
    TempStr1 := Edit_Last.Text;
    TempStr2 := Edit_First.Text;
    blanks := '________';
     If Length(TempStr1) < 9
    then
      TempStr1 := TempStr1 + copy(blanks,1,(9-Length(TempStr1)));
    If Length(TempStr2) < 9
    then
      TempStr2 := TempStr2 + copy(blanks,1,(9-Length(TempStr2)));
    ID := TempStr1 + TempStr2;
    FieldValues['ID'] := ID;
    FieldValues['Last_Name'] := Edit_Last.Text;
    FieldValues['First_Name'] := Edit_First.Text;
    FieldValues['Street'] := Edit_Street.Text;
    FieldValues['City'] := Edit_City.Text;
    FieldValues['St'] := Edit_St.Text;
    FieldValues['ZIP'] := Edit_ZIP.Text;
    FieldValues['Env'] := Edit_Env.Text;
    FieldValues['Phone'] := Edit_Phone.Text;
    FieldValues['Email'] := Edit_Email.Text;
    FieldValues['Member'] := Edit_Member.Text;
    FieldValues['Opn_Pledge_2000'] := Edit_Opn_Pledge_2000.Text;
    FieldValues['Opn_Gift_2000'] := Edit_Opn_Gift_2000.Text;
    FieldValues['Opn_Pledge_2001'] := Edit_Opn_Pledge_2001.Text;
    FieldValues['Cap_Pledge'] := Edit_Cap_Pledge.Text;
    FieldValues['Cap_Gift_2000'] := Edit_Cap_Gift_2000.Text;
    Post;
  end;
end;

With "edit" obmitted from this procedure, I get the following message:

Table_Names: Dataset is not in edit or insert mode.

With "edit" included in this procedure, I get the following message:

Record locked by another user.
C:\MY FILES\DELPHI\COGS_DATA\COGS|NAMES.DB
User: Mervin L. Norton

I hope this info can assisyou in resolving my problem.

Merv Norton
MLNor...@earthlink.net

Quote
" (Colin Acheson)" wrote:
> After a little more thought and seeing Bill Todd's answer, it occurred
> to me that maybe the table is being put into edit mode when you select
> the record from the DBGrid.  This is all guesswork without seeing the
> code but perhaps you need to set dgEditing to false in the DBGrid's
> "Options" property.

> Otherwise, if you are using the same instance of the table for the
> grid and the editing form, then as Bill said you may just have to call
> Post in the editing form rather than Edit and Post.

> On Tue, 14 Nov 2000 01:21:05 GMT, <nomail.please> (Colin Acheson)
> wrote:

> >Unless you've accidentally set exclusive to true for the table, that
> >should not happen.

Re:Paradox locked record - need to unlock


Quote
In article <3A10CE14.F9901...@earthlink.net>, Mervin L. Norton wrote:
> With "edit" included in this procedure, I get the following message:

> Record locked by another user.

Are you running this from the IDE and have the table open at design time?
You cannot do this if the table is opened exclusively.

 Mike Orriss (TeamB & Developer Express)
 (Unless stated otherwise, my replies relate to Delphi 5)
 (No unsolicited e-mail replies please)

Re:Paradox locked record - need to unlock


On Tue, 14 Nov 2000 00:31:01 -0500, "Mervin L. Norton"

Quote
<MLNor...@earthlink.net> wrote:
>My problem remains unsolved.

>The following information may help you with a solution.

>Table_Names
>  Active = True;
>  Exclusive = True

If what you say above is correct, then Mike has probably given you the
answer.   Set exclusive to false unless there is a very good reason
for putting the table in exclusive mode.

Regards,
Colin Acheson

Re:Paradox locked record - need to unlock


I am using the IDE and at startup the following are settings for the Table
and DBGrid.

Table_Names
  Active = True;
  Exclusive = False  (my inital message was incorrect)

DBGrid_Names
  Enabeled = True
  dbEditing = False

Merv Norton
MLNor...@earthlink.net

Quote
" (Colin Acheson)" wrote:
> On Tue, 14 Nov 2000 00:31:01 -0500, "Mervin L. Norton"
> <MLNor...@earthlink.net> wrote:

> >My problem remains unsolved.

> >The following information may help you with a solution.

> >Table_Names
> >  Active = True;
> >  Exclusive = True

> If what you say above is correct, then Mike has probably given you the
> answer.   Set exclusive to false unless there is a very good reason
> for putting the table in exclusive mode.

> Regards,
> Colin Acheson

Re:Paradox locked record - need to unlock


use the same TTable

Mervin L. Norton <MLNor...@earthlink.net> escribi en el mensaje de noticias
3A1085E1.18FE3...@earthlink.net...

Quote
> I have a program that has a Table of names and addresses (Table_Names)
> displayed in a DBGrid (DBGrid_Names). This form is used to create
> transactions on about 300 families. Occasionally, I need to edit a set
> of
> Family data or add a set of Family data. I have an additional form that
> is
> called from the MainMenu. I can call this additional form for Editing or

> Adding New Family data. In either case I then need to write this data to

> Table_Names (Paradox file, Cogs_Names.DB). The DBGrid displays
> only two fields of the 15 fields in Table_Names. I When I call the
> additional Form for editing, the data from the active fields in the
> DBGrid
> are displayed in the editing Form. So far, so good. When I edit any of
> the
> 15 fields and try to Post, I get a message that says the Paradox file is
> in
> use by another user, which is me. I know this is a characteristic of
> Paradox files but this is a single user program. I need to be able to
> edit
> the data in the Table_Names. After editing or adding Family data, the
>  Form is closed and the original Form is again fully visible and the
> operation continues.

> How can I overcome the Paradox record locking?

> Merv Norton
> MLNor...@earthlink.net

Re:Paradox locked record - need to unlock


Setting the Exclusive property to True locks the entire table. Are you
running your application from the IDE? Is the table open at design time? If
so, the error is caused by your app trying to open the table when the IDE
already has it opened exculsively.

--
Bill

Re:Paradox locked record - need to unlock


In that case, I still think the grid may be the culprit.  Try setting
the DBGrid's "ReadOnly" property to true.

If that doesn't fix it:

(a) Check the code that you use to populate the edit boxes in the
editing form.   Make sure nothing there is putting the table in edit
mode.

(b) Check your BDE setup.   I am a dBase user, so am not the best
person to advise you here, but I believe in a stand-alone setup, the
NET DIR setting of the paradox driver would normally point to C:\
Ensure there is only one copy of Pdoxusrs.net on your machine and that
it is in the location pointed to by NET DIR.   Also, before starting
Delphi and your app., do a search for any *.lck files and delete them.

Regards,
Colin Acheson      

On Tue, 14 Nov 2000 11:41:48 -0500, "Mervin L. Norton"

Quote
<MLNor...@earthlink.net> wrote:
>I am using the IDE and at startup the following are settings for the Table
>and DBGrid.

>Table_Names
>  Active = True;
>  Exclusive = False  (my inital message was incorrect)

Other Threads