stenodegio
17th March 2009, 21:22
Hi all,
I have a problem using dynamic sql and updating the index field of the table.
After the updating, the same record is selected again and so on, and always the same record is updated.
Could someone help me?
Thanks
this is my script:
tblid = db.bind("t" & table.name, "", company.fis)
if tblid > 0 then
sql = sql.parse(
"select " & table.name & ".*" &
" from " table.name & " for update" &
" where " & table.name & "._compnr = " & str$(company.fis))
sql.exec(sql)
while ( TRUE )
on case ( sql.fetch(sql) )
case EENDFILE:
break
case ENOREC:
sql.break(sql)
sql.close(sql)
sql = 0
error.message = "No data"
rprt_send()
return(FALSE)
case 0:
str1 = column.name & ":=" & column.name & "+" & str$(offset.in.seconds)
var1 = expr.compile(str1)
s.expr$(var1) db.update(tblid, db.retry)
commit.transaction()
continue
default: | error
sql.break(sql)
sql.close(sql)
sql = 0
error.message = "Error"
rprt_send()
return(FALSE)
endcase
break
endwhile
sql.break(sql)
sql.close(sql)
sql = 0
db.unbind(tblid)
endif
I have a problem using dynamic sql and updating the index field of the table.
After the updating, the same record is selected again and so on, and always the same record is updated.
Could someone help me?
Thanks
this is my script:
tblid = db.bind("t" & table.name, "", company.fis)
if tblid > 0 then
sql = sql.parse(
"select " & table.name & ".*" &
" from " table.name & " for update" &
" where " & table.name & "._compnr = " & str$(company.fis))
sql.exec(sql)
while ( TRUE )
on case ( sql.fetch(sql) )
case EENDFILE:
break
case ENOREC:
sql.break(sql)
sql.close(sql)
sql = 0
error.message = "No data"
rprt_send()
return(FALSE)
case 0:
str1 = column.name & ":=" & column.name & "+" & str$(offset.in.seconds)
var1 = expr.compile(str1)
s.expr$(var1) db.update(tblid, db.retry)
commit.transaction()
continue
default: | error
sql.break(sql)
sql.close(sql)
sql = 0
error.message = "Error"
rprt_send()
return(FALSE)
endcase
break
endwhile
sql.break(sql)
sql.close(sql)
sql = 0
db.unbind(tblid)
endif