Subject Re: Delete SQL
Author mmenaz@lycosmail.com
I don't know about Tutorial1, but I think you have a little confused
about TIB_Query.
Generally speaking, double click on the TIB_Query component on your
form, and set the WHERE part of the SQL (SQL tab), set IB_Query
"requestlive" property to true, then you can add/edit/delete records
at will (if your query has not join conditions).
In you code there are some errors like:
> ...
> open;
> edit;
> // execute; <<<< --- which works? Or should I use Stored
Proc to
> achieve this ?
> delete; <<<- error here

a) Execute is for StoredPocedures
b) if you enter in edit mode, you can't delete the current record
c) use IB_bars (update, navigation, etc.) for automatic basic tasks
d) leave insertSql and deleteSQL for an more advanced stage

Go to tutorial2 for this kind of stuff, since Tutorial1 is to learn
connection concepts.
I know the beginning is hard, but IBO worths the troubles :)
My best suggestion to you is to buy the Getting Started Guide
http://www.ibobjects.com/ibo_gsg.html
it's a great tutorial.
Regards :)
Marco Menardi

--- In IBObjects@y..., "Paul Hoshovsky" <paulh@o...> wrote:
> Hi
>
> After modifying Tutorial1 (yes that's where I am now), I am confused
as to
> how to eliminate the 'cannot delete current row' error.
>
> The first part of the following code works just fine. It's when I
try to
> execute the delete then the error occurs.
>
> I apologise for the simplistic problem as I have been out of the
> BDE/Interbase for quite a while.
>
> Thanks
>
> --------------
>
> procedure TfrmTutorial1.Button2Click(Sender: TObject);
> begin
> with ib_query1 do
> begin
> insertSql.clear;
> InsertSql.add('insert into mytest (barcode) values
> ('+chr(39)+'hello2'+chr(39)+')');
> edit;
> insert;
> post;
> close;
>
> deleteSql.clear;
> deleteSql.add('delete from mytest where barcode
> ='+chr(39)+'hello1'+chr(39));
> open;
> edit;
> // execute; <<<< --- which works? Or should I use Stored
Proc to
> achieve this ?
> delete; <<<- error here
> close;
> end;