refreshrecord crashes with unknown column
Posted: Mon 25 Jun 2007 15:17
I have Delphi 7 and mydac version 3.55.0.21 30.05.05
sometimes i do a refreshrecord and i got the following sql request:
Select tim_id, tim_Ref, grp_id, erinnerung, termin, sys_arc.arc_id, arc_name, doc_id, doc_titel, info, status, usr_id_work, Optionen from sys_timer left join sys_arc using(arc_id) where usr_id_work = 15 and (( status 2)) and ((Termin between '2007-06-25 00:00:00' and '2007-07-01 23:59:59' ) or (Termin < '2007-06-25 00:00:00'))
AND sys_timer.tim_id = :Old_1 order by termin
it returns properly
on a similar case (i am not that familiar with the code)
i use refreshrecord and the command is:
Select Sql_No_cache tim_id, tim_ref, sys_timer.grp_id, termin, sys_arc.arc_id, arc_name, doc_id, doc_titel, if(grp_name is not null, grp_name, usr_name) as usr_name,erinnerung, info, status, usr_id_work from sys_timer left join sys_arc using(arc_id) left join sys_usr on sys_usr.usr_id = sys_timer.usr_id_work left join sys_grp on sys_grp.grp_id = sys_timer.grp_id where (usr_id_work = 15 or usr_id_shed = 15)
AND sys_timer.tim_id = :Old_1 AND sys_timer.tim_ref = :Old_2 AND sys_timer.grp_id = :Old_3 AND sys_timer.termin = :Old_4 AND sys_timer.doc_id = :Old_7 AND sys_timer.doc_titel = :Old_8 AND sys_timer.usr_name = :Old_9 AND sys_timer.erinnerung = :Old_10 AND sys_timer.info = :Old_11 AND sys_timer.status = :Old_12 AND sys_timer.usr_id_work = :Old_13 group by tim_ref order by termin
now it throws an exception of the class EMySqlExcaption:
Unknown Column 'sys_timer.usr_name' in 'where clause'
if i set
dm_DB.my_q_time.SQLRefresh.Text :=dm_DB.my_q_time.SQL.Text;
try
dm_DB.my_q_time.RefreshRecord;
except;
end;
i get always an exception of the calss EDatabaseError:
'refresh failed. Found 4 records.'
What am i doing wrong?
sometimes i do a refreshrecord and i got the following sql request:
Select tim_id, tim_Ref, grp_id, erinnerung, termin, sys_arc.arc_id, arc_name, doc_id, doc_titel, info, status, usr_id_work, Optionen from sys_timer left join sys_arc using(arc_id) where usr_id_work = 15 and (( status 2)) and ((Termin between '2007-06-25 00:00:00' and '2007-07-01 23:59:59' ) or (Termin < '2007-06-25 00:00:00'))
AND sys_timer.tim_id = :Old_1 order by termin
it returns properly
on a similar case (i am not that familiar with the code)
i use refreshrecord and the command is:
Select Sql_No_cache tim_id, tim_ref, sys_timer.grp_id, termin, sys_arc.arc_id, arc_name, doc_id, doc_titel, if(grp_name is not null, grp_name, usr_name) as usr_name,erinnerung, info, status, usr_id_work from sys_timer left join sys_arc using(arc_id) left join sys_usr on sys_usr.usr_id = sys_timer.usr_id_work left join sys_grp on sys_grp.grp_id = sys_timer.grp_id where (usr_id_work = 15 or usr_id_shed = 15)
AND sys_timer.tim_id = :Old_1 AND sys_timer.tim_ref = :Old_2 AND sys_timer.grp_id = :Old_3 AND sys_timer.termin = :Old_4 AND sys_timer.doc_id = :Old_7 AND sys_timer.doc_titel = :Old_8 AND sys_timer.usr_name = :Old_9 AND sys_timer.erinnerung = :Old_10 AND sys_timer.info = :Old_11 AND sys_timer.status = :Old_12 AND sys_timer.usr_id_work = :Old_13 group by tim_ref order by termin
now it throws an exception of the class EMySqlExcaption:
Unknown Column 'sys_timer.usr_name' in 'where clause'
if i set
dm_DB.my_q_time.SQLRefresh.Text :=dm_DB.my_q_time.SQL.Text;
try
dm_DB.my_q_time.RefreshRecord;
except;
end;
i get always an exception of the calss EDatabaseError:
'refresh failed. Found 4 records.'
What am i doing wrong?