Board index » delphi » locate/seek & reserved words

locate/seek & reserved words

BlankHi All

this would hopefully be an easy one...

I use  a tadodataset and run a query to return a few fields like such:
SELECT DISTINCT Stmast.CODE, Stmast."DESC", Stmast.COST, Stmast.ONHAND,
Stmast.GST, Sttax.TAXR, Sttax.TAXP
FROM "STMAST.DBF" Stmast
   INNER JOIN "STTAX.DBF" Sttax
   ON  (Stmast.GST = Sttax.TAXR)

create sort on code or desc according to grid.titleclick
tadodataset.Sort := '' + '[' + Column.FieldName + ']' + ''
-> Works nicely

try 1:
now I try to do a seek on this temporary sort ->
tadodataset.Seek(SearchText,soBeforeEQ ) , causes fallover

try 2:
sField := '"' + fieldname + '"' attempt1 to try and compensate for 'DESC'
fieldname
sField := '[' + fieldname + ']' atempt2 to try and compensate for 'DESC'
fieldname
DStock.Locate(sField, SearchText, [loCaseInsensitive, loPartialKey])

now a normal
    DStock.Locate('CODE', SearchText, [loCaseInsensitive, loPartialKey])
works OK , so I presume
    it's something to do with the reserved word 'DESC'

I would really appreciate any help on either search methods

thanks
George

 

Re:locate/seek & reserved words


Hi All

this would hopefully be an easy one...

I use  a tadodataset and run a query to return a few fields like such:
SELECT DISTINCT Stmast.CODE, Stmast."DESC", Stmast.COST, Stmast.ONHAND,
Stmast.GST, Sttax.TAXR, Sttax.TAXP
FROM "STMAST.DBF" Stmast
   INNER JOIN "STTAX.DBF" Sttax
   ON  (Stmast.GST = Sttax.TAXR)

create sort on code or desc according to grid.titleclick
tadodataset.Sort := '' + '[' + Column.FieldName + ']' + ''
-> Works nicely

try 1:
now I try to do a seek on this temporary sort ->
tadodataset.Seek(SearchText,soBeforeEQ ) , causes fallover

try 2:
sField := '"' + fieldname + '"' attempt1 to try and compensate for 'DESC'
fieldname
sField := '[' + fieldname + ']' atempt2 to try and compensate for 'DESC'
fieldname
DStock.Locate(sField, SearchText, [loCaseInsensitive, loPartialKey])

now a normal
    DStock.Locate('CODE', SearchText, [loCaseInsensitive, loPartialKey])
works OK , so I presume
    it's something to do with the reserved word 'DESC'

I would really appreciate any help on either search methods

thanks
George

Other Threads