Article View: borland.public.interbase.thirdparty
Article #178Re: Using TIBQuery for Update
From: Jeff Overcash (TeamB)
Date: Sun, 28 Jan 2007 06:33
Date: Sun, 28 Jan 2007 06:33
53 lines
2682 bytes
2682 bytes
Jack Mason wrote:
> We have the following code:
>
> ...
>
> var Stock_Location: string;
> ...
>
> procedure TMainForm.TestQueryBeforePost(DataSet: TDataSet);
> begin
> DataSet.FieldByName('LOCATION').AsString := Stock_Location;
> end;
>
> procedure TMainForm.SetLocation;
> begin
> ...
>
> Stock_Location := '33';
> TestQuery.Close;
> TestQuery.SQL.Text := 'SELECT * FROM STOCK WHERE STOCKNO=''' +
> StockNo_Str + '''';
> TestQuery.Open;
> if not TestQuery.IsEmpty then
> begin
> TestQuery.Edit;
> TestQuery.Post;
> end
> else
> begin
> TestQuery.Append;
> TestQuery.Post;
> end;
> ..
> end;
>
> TestQuery.ReadOnly is set to False, TestQuery.Unidirectional is set to
> False, yet when the TestQuery.Edit or TestQuery.Append executes, there
> is an error message saying "Cannot modify a read-only dataset".
>
> What are we doing wrong?
You have to add an IBUpdateSQL component, link the two and set the update SQL to
make IBQuery read/write.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly. Specialization is for
insects. (RAH)
Technical Details
Message-ID:
<45bc4373$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45ba2e55$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f688a,3a8b0ce2c3e5ed6d X-Google-Attributes: gidf688a,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Sun, 28 Jan 2007 01:33:10 -0500 From: "Jeff Overcash (TeamB)" <jeffovercash@mindspring.com> Organization: TeamB User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.interbase.thirdparty Subject: Re: Using TIBQuery for Update References: <45ba2e55$1@newsgroups.borland.com> In-Reply-To: <45ba2e55$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 66.32.160.128 Message-ID: <45bc4373$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1169965939 66.32.160.128 (27 Jan 2007 22:32:19 -0800) Lines: 53 X-Authenticated-User: overcash Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail