Board index » delphi » Table is readonly

Table is readonly

Hi,

    On the back side I have a MS SQL Server version 6.5. I am using ODBC to
connect to the database. If the application consists of a single query, the
following code

with Query1 do begin
    SQL.Clear;
    SQL.Add('insert into CLIENTS (CNAME) values (''dummy'')');
    EXECSQL;
     end;

results in

        "Table is readonly."

obviously, I am forgetting to set something, but what

 

Re:Table is readonly


set the requestlive property to TRUE
Quote
Joshua Lutz wrote:
> Hi,

>     On the back side I have a MS SQL Server version 6.5. I am using ODBC to
> connect to the database. If the application consists of a single query, the
> following code

> with Query1 do begin
>     SQL.Clear;
>     SQL.Add('insert into CLIENTS (CNAME) values (''dummy'')');
>     EXECSQL;
>      end;

> results in

>         "Table is readonly."

> obviously, I am forgetting to set something, but what

Re:Table is readonly


In article <7mdplu$rp...@forums.borland.com>, j...@prowireless.com (Joshua

Quote
Lutz) wrote:
> results in

>         "Table is readonly."

Sounds like you do not have the correct rights to insert into the table.
Use Enterprise Manager to grant the appropriate rights for the user.

Hope this helps.

Re:Table is readonly


Hi,

    Actually, I am logged in as SA so that I have fully rights (the SQL
server is in my house and the network is private, so all logins are SA). I
can set up a DBGrid and a DBNavigator and "edit to my heart's delight". Yet
a simple insert or update {*word*88}s with a "Table is readonly."

    I am assuming from the fact that DBGrid/DBNavigator allow all updates
that the SQL / ODBC links are okay - thus it must be something that Meathead
(that me when I{*word*222}up like this) is doing something stupidly wrong. In
simplest form, I have a single query, a single datasource, a DBGrid and
DBNavigator. DBNavigator & DBGrid tie to the DataSource which ties to the
Query. The query connects via ODBC to the SQLServer. At this point all is
fine and we can modify the data.

    Now we add two buttons and use the OnClicks with

    procedure Tform1.Button1Click(Sender: TObject);
    begin
         with Query1 do begin
              Close;
              SQL.Clear;
              SQL.Add('select * from DONORS');
              Open;
         end;
    end;

    procedure Tform1.Button2Click(Sender: TObject);
    begin
         with Query1 do begin
              Close;
              SQL.Clear;
              SQL.Add('update DONORS set Name = ''dummy'' where Id = 1'); //
consider this a valid SQL statement as far as the SQL Enterprise Manager is
concerned - namely DONORS, Name and Id are valid etc
              Open;
         end;
    end;

     Button1 will click without any errors -
     Button2 will click yielding "Table is readonly!"

    How can the same table be read/write by the same query in one instance
but not in the other?

Quote
Trevor Toms <s...@msn.com> wrote in message

news:memo.19990715082942.189B@tt.msn.com...
Quote
> In article <7mdplu$rp...@forums.borland.com>, j...@prowireless.com (Joshua
> Lutz) wrote:

> > results in

> >         "Table is readonly."

> Sounds like you do not have the correct rights to insert into the table.
> Use Enterprise Manager to grant the appropriate rights for the user.

> Hope this helps.

Re:Table is readonly


Okay, Gals and Guys,

This is very embarrassing: RequestLive must be false!

Background:

MS-SQLServer v 6.5
ODBC
BDE

Application:
a simple TQuery that inserts or updates a table on the server via ODBC. If
RequestLive is true, ExecSQL returns an error that the "Table is readonly!"
This message is misleading. The correct sequence for ExecSQL is

with Queryn do begin
    RequestLive:=false;
    ExecSQL;
    end;

Knowledge cost money, in this case One Developer Incident!

Other Threads