[菜鸟问题042]我在UserSession里定义了一个日期时间函数,写代码时delphi居然不提示对象的属性了,有UserSession的全部源码,请您帮我指

  • 主题发起人 ww111222
  • 开始时间
W

ww111222

Unregistered / Unconfirmed
GUEST, unregistred user!
[菜鸟问题042]我在UserSession里定义了一个日期时间函数,写代码时delphi居然不提示对象的属性了,有UserSession的全部源码,请您帮我指正一下?谢谢 (0分)<br />unit UserSessionUnit;

{
This is a DataModule where you can add components or declare fields that are specific to
ONE user. Instead of creating global variables, it is better to use this datamodule. You can then
access the it using UserSession.
}
interface

uses
IWUserSessionBase, SysUtils, Classes, DB, Ora, MemDS, DBAccess, OraSmart;

type
TIWUserSession = class(TIWUserSessionBase)
OraSession1: TOraSession;
SmartQuery1: TSmartQuery;
OraDataSource1: TOraDataSource;


public
//定义一个函数,取服务器时间
function Server_datetime():TDateTime;


end;

implementation

{$R *.dfm}

//////////////////////////////////////////////////////////
//自定义的取服务器时间的函数
//////////////////////////////////////////////////////////
function TIWUserSession.Server_datetime():TDateTime;
var
temp_sql: string;
begin
temp_sql := 'select to_char(sysdate,''' + 'yyyy-mm-dd hh24:mi:ss' + '''' + ') from dual';

smartquery1. //这里不出smartquery1的方法、属性提示

end;

end.


我哪出错了?


  您帮我看看?


  谢谢



如果在别的form里引用usersession的东西
则会提示下面的错误提示:


[Pascal Error] Unit1.pas(1): Unable to invoke Code Completion due to errors in source code
[Fatal Error] Unit1.pas(22): Could not compile used unit 'D:/My Documents/My Delphi/练习/带模板的登录界面/UserSessionUnit.pas'


如果我把这个函数全部 {}掉,则正常
 
temp_sql := 后面的代码正确,传到oracle服务器里就是下面的结果

select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual

在pl/sql里可以取oracle的服务器日期时间
 

搞定了,谢谢大家了
 
接受答案了.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
873
DelphiTeacher的专栏
D
顶部