monica1
24th September 2004, 11:42
I try to delete records of tables with dynamic sql but It doen`t delete anything. This is the code I'm using.



string sql.string(256)
domain tcmcs.long sql

sql.string = "select " & str$(mi.tabla)
& " from " & str$(mi.tabla) & " for update"
& " where " & clausula.where
sql = sql.parse(sql.string)
sql.where.bind(sql, 1, tfgld008.leac)
sql.exec(sql)
on case (sql.fetch(sql))
case 0:
db.delete(sql, db.retry)
case eendfile:
break
endcase
sql.break(sql)
sql.close(sql)
commit.transaction()



Where is my problem?

mr_suleyman
24th September 2004, 12:22
Hello there firstly control case 0: Did it work for this case ?
if it didn,t work for case 0 , this mean that your operation was fail !

monica1
24th September 2004, 12:32
Yes, It works for case 0, and it go to commit.transaction() but the record continue in the table when the program finish.

Hitesh Shah
24th September 2004, 13:00
Use the function db.bind to to the table to create table pointer and use the db.update / db.delete with the return value of db.bind ie table pointer.

monica1
24th September 2004, 13:37
Thank you very much, it works fine.