Jump to content

SQL related

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
2710

2710

    Programmer

  • Members
  • PipPipPipPip
  • 110 posts
So I have got something similar to this:

Adotable.Locate(A,B,[]);
Qryupdatenote.SQL.Add('Update GiftAid');
Qryupdatenote.SQL.Add('Set LetterNote = ''1''');
Qryupdatenote.ExecSQL;

I want it to update WHERE the ADotable is currently at (Ie the located row). Is it possible to do this? I dont want to have to do another piece of code where I have to search for it, that will be inefficient.

Thanks!

and no, I can't do:

Qryupdatenote.SQL.Add(' Where A = ''B''');

Since in my program I am actually using the adotable 1st, and a while loop with the adotable.next function. I want it to look at the currently highlighted row. Possible?

Thanks

Bump?

Something like this:

http://publib.boulde...rbafycurs5a.htm

But I dont know what my cursor name is called...

any help pleeeassse :D

Edited by Vswe, 15 March 2010 - 03:06 AM.


#2
Firebird_38

Firebird_38

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Don't update the table with SQL queries. Use the dataset's fields.

 
GiftAidAdoTable['LetterNote']:=1; 
GiftAidAdoTable.Post;

SQL is for batch stuff mostly (in Delphi). You can mess with a whole bunch of rows and do joins and such... But for single field/single record updates, just use the fields of the DataSet, especially when your dataset's cursor is already at the right record.

Posted Image