谢谢大家这么快回答我。后边设了一些点,发现不是timer的问题,现在贴出代码A部分代码: Str_Sql := 'select top 1 * from t_Mails where ToAddr =:ToAddr and ReaderFlag=1 and ' ; Str_Sql := Str_Sql + ' MailID in ( select top 5 MailID from t_Mails where ToAddr =:ToAddr_2 order by SenderDate desc) order by SenderDate desc '; Query_PopMail.Connection := DM.CONN; Query_PopMail.Close; Query_PopMail.SQL.Clear; Query_PopMail.SQL.Add(Str_Sql); Query_PopMail.Parameters.ParamByName('ToAddr').Value := GetComptName + '|' + GetIP; Query_PopMail.Parameters.ParamByName('ToAddr_2').Value := GetComptName + '|' + GetIP;sql2000 跟踪器显示: exec sp_executesql N'select top 1 * from t_Mails where ToAddr =@P1 and ReaderFlag=1 and MailID in ( select top 5 MailID from t_Mails where ToAddr =@P2 order by SenderDate desc) order by SenderDate desc ', N'@P1 varchar(19),@P2 varchar(19)', '统计室|202.202.202.', '统计室|202.202.202.' B部分代码: Query_MailList.Connection := DM.CONN; Query_MailList.Close; Query_MailList.SQL.Clear; Query_MailList.SQL.Add('select top 10 * from t_Mails where ToAddr =:ToAddr order by SenderDate desc'); Query_MailList.Parameters.ParamByName('ToAddr').Value := GetComptName + '|' + GetIP; Query_MailList.Open; sql2000 跟踪器显示: exec sp_executesql N'select top 10 * from t_Mails where ToAddr =@P1 order by SenderDate desc ', N'@P1 varchar(255)', '统计室|202.202.202.234' 在我自己机器上,包括客户那里装delphi的机器都没有问题。 没有装delphi的机器就出问题了。 ParamByName('ToAddr_2').Value := GetComptName + '|' + GetIP;'统计室|202.202.202.'
LZ是说自己写的exe timer没运行?
理论上不会出现的
检查你的原代码,重新编译
可能是运行了,但是操作被杀毒或者系统禁止了
vista以上尝试使用管理员权限运行exe,或者看看关掉360
还是触发了但因为条件不同,没执行有效果的事情?
Str_Sql := 'select top 1 * from t_Mails where ToAddr =:ToAddr and ReaderFlag=1 and ' ;
Str_Sql := Str_Sql + ' MailID in ( select top 5 MailID from t_Mails where ToAddr =:ToAddr_2 order by SenderDate desc) order by SenderDate desc ';
Query_PopMail.Connection := DM.CONN;
Query_PopMail.Close;
Query_PopMail.SQL.Clear;
Query_PopMail.SQL.Add(Str_Sql);
Query_PopMail.Parameters.ParamByName('ToAddr').Value := GetComptName + '|' + GetIP;
Query_PopMail.Parameters.ParamByName('ToAddr_2').Value := GetComptName + '|' + GetIP;sql2000 跟踪器显示:
exec sp_executesql N'select top 1 * from t_Mails where ToAddr =@P1 and ReaderFlag=1 and MailID in ( select top 5 MailID from t_Mails where ToAddr =@P2 order by SenderDate desc) order by SenderDate desc
', N'@P1 varchar(19),@P2 varchar(19)', '统计室|202.202.202.', '统计室|202.202.202.'
B部分代码:
Query_MailList.Connection := DM.CONN;
Query_MailList.Close;
Query_MailList.SQL.Clear;
Query_MailList.SQL.Add('select top 10 * from t_Mails where ToAddr =:ToAddr order by SenderDate desc');
Query_MailList.Parameters.ParamByName('ToAddr').Value := GetComptName + '|' + GetIP;
Query_MailList.Open;
sql2000 跟踪器显示:
exec sp_executesql N'select top 10 * from t_Mails where ToAddr =@P1 order by SenderDate desc
', N'@P1 varchar(255)', '统计室|202.202.202.234'
在我自己机器上,包括客户那里装delphi的机器都没有问题。 没有装delphi的机器就出问题了。 ParamByName('ToAddr_2').Value := GetComptName + '|' + GetIP;'统计室|202.202.202.'
ParamByName('ToAddr').Value := GetComptName + '|' + GetIP;
SQL跟踪器
'统计室|202.202.202.234'
但是2个参数的时候
Query_PopMail.Parameters.ParamByName('ToAddr').Value := GetComptName + '|' + GetIP;
Query_PopMail.Parameters.ParamByName('ToAddr_2').Value := GetComptName + '|' + GetIP;
'统计室|202.202.202.', '统计室|202.202.202.'就变成这样了,如果是版本不对,一个参数的时候也应该有问题
参数名不要使用下划线,会不会就没问题了?没怎么使用过参数方式,都是直接拼凑sql的。。
2个参数时:N'@P1 varchar(19)', '统计室|202.202.202.'
参数的长度信息 自动 变短了?!