实例介绍
【实例简介】
delphi 7 联接oracle9 源码
【实例截图】
【核心代码】
procedure TForm1.Button1Click(Sender: TObject);
var
sqlstr: string;
sqlstr2: string;
i, j: Integer;
k: Integer;
begin
try
OraSession1.Options.Net := True;
OraSession1.Username := trim(user_Global);
OraSession1.Password := trim(password_Global);
OraSession1.Server := trim(server_Global);
OraSession1.Connect;
except
barMessage.Panels[1].Text := ' 断开';
exit;
end;
barMessage.Panels[1].Text := ' 正常';
{
DISTINCT train as 车次,id as 工号,name as 姓名,room as 房间,actin as 入寓时间,'
'actout as 出寓时间,seat as 床位,worksite as 地点 '
'
}
sqlstr := ' select room,name from s_standbytime where nvl2(actout,0,1)=1 '
' and worksite = ' QuotedStr(caption_Global)
' and dat between to_date('
QuotedStr(DateToStr(Date() - 1)) ',' QuotedStr('yyyy-mm-dd') ') and to_date('
QuotedStr(DateToStr(Date())) ',' QuotedStr('yyyy-mm-dd') ') order by room,seat';
OraQuery1.sql.clear;
OraQuery1.sql.add(sqlstr);
OraQuery1.Active := True;
sqlstr2 := 'select DISTINCT room from S_room where worksite= ' QuotedStr(caption_Global);
OraQuery2.sql.clear;
OraQuery2.sql.add(sqlstr2);
OraQuery2.Active := True;
if (h_int = 8) and (OraQuery2.RecordCount <> 8) then begin
h_int := OraQuery2.RecordCount div 5 1;
Timer_h.Enabled := True;
end;
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TStaticText then
if TStaticText(Components[i]).Caption = 'StaticText1' then
TStaticText(Components[i]).Caption := '';
if Components[i] is TLabel then
TLabel(Components[i]).Caption := '';
if Components[i] is TPanel then
if TPanel(Components[i]).Color <> clSkyBlue then
TPanel(Components[i]).Color := clLime;
end;
OraQuery2.First;
k := 1;
while not OraQuery2.Eof do begin
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TStaticText then
begin
if TStaticText(Components[i]).Parent.Tag = k then begin
if TStaticText(Components[i]).Caption = '' then begin
TStaticText(Components[i]).Caption := trim(OraQuery2.FieldList[0].AsString);
TStaticText(Components[i]).Tag := k;
TStaticText(Components[i]).Font.Color := clBlack;
TStaticText(Components[i]).Font.Style := [fsBold];
TStaticText(Components[i]).Font.Name := '隶书';
TStaticText(Components[i]).Font.Size := 42;
TStaticText(Components[i]).Alignment := taLeftJustify;
TStaticText(Components[i]).Left := 15;
TStaticText(Components[i]).top := 15;
TStaticText(Components[i]).AutoSize := True;
end;
end;
end;
if Components[i] is TLabel then
begin
if TLabel(Components[i]).Parent.Tag = k then begin
TLabel(Components[i]).Tag := k;
TLabel(Components[i]).Caption := '';
TLabel(Components[i]).Font.Color := clBlack;
TLabel(Components[i]).Font.Style := [];
TLabel(Components[i]).Font.Size := 18;
TLabel(Components[i]).Left := TStaticText(Components[i]).Parent.Width div 2;
TLabel(Components[i]).top := TStaticText(Components[i]).Parent.Height div 3;
TLabel(Components[i]).AutoSize := True;
end; end;
end;
k := k 1;
OraQuery2.Next;
end;
OraQuery1.First;
while not OraQuery1.Eof do begin
for i := 0 to ComponentCount - 1 do
begin
k := 0;
if Components[i] is TStaticText then begin
if TStaticText(Components[i]).Caption = trim(OraQuery1.FieldList[0].AsString) then begin
k := TStaticText(Components[i]).Tag;
end;
end;
for j := 0 to ComponentCount - 1 do
begin
if Components[j] is TLabel then
begin
if (TLabel(Components[j]).Tag = k) and (k > 0) then
if TLabel(Components[j]).Caption <> trim(OraQuery1.FieldList[1].AsString) then
if TLabel(Components[j]).Caption = '' then
TLabel(Components[j]).Caption := trim(OraQuery1.FieldList[1].AsString)
else
TLabel(Components[j]).Caption := TLabel(Components[j]).Caption #13 trim(OraQuery1.FieldList[1].AsString);
end;
if Components[j] is TPanel then
begin
if (TPanel(Components[j]).Tag = k) and (k > 0) then
TPanel(Components[j]).Color := clFuchsia;
end;
end;
end;
OraQuery1.Next;
end;
end;
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论