D
dv500
Unregistered / Unconfirmed
GUEST, unregistred user!
用delphi作核心的查询,效果很好
具体实现如下:
用frontpage作一个<form></form>.,用来设定条件
用户提交后 用以下语句读取:
Str_xmbh:=request.ContentFields.Values['xmbh'];
Str_hth:=request.ContentFields.Values['hth'];
Str_xmmc:=request.ContentFields.Values['xmmc'];
Str_fzr:=request.ContentFields.Values['fzr'];
Str_op1:=request.ContentFields.Values['op1'];
Str_qsny:=request.ContentFields.Values['qsny'];
Str_qsny1:=request.ContentFields.Values['qsny1'];
sTR_OP2 :=request.ContentFields.Values ['op2'];
Str_qsny2:=request.ContentFields.Values['qsny2'];
Str_zzny:=request.ContentFields.Values['zzny'];
Str_zzny1:=request.ContentFields.Values['zzny1'];
Str_zzny2:=request.ContentFields.Values['zzny2'];
然后根据读取得信息生成 Sql 语句(这不用多说了吧)
生成SQl以后:
adoquery2.SQL.Clear ;
adoquery2.SQL.Add (str_Sql);
adoquery2.Active :=true;
if adoquery2.Recordset.EOF and adoquery2.Recordset.BOF then
begin
response.Content:='没有记录' ;
end
else
begin
response.Content :=response.Content +'本次查询共查到'+ inttostr(adoquery2.Recordset.RecordCount) +'条记录';
RESPONSE.Content :=RESPONSE.Content +'<table border="1" width="100%">';
adoquery2.Recordset.MoveFirst;
while not adoquery2.Eof do
begin
RESPONSE.Content :=RESPONSE.Content+'<TR>';
//开始循环写入表格
for i:=0 to adoquery2.Recordset.Fields.Count-1 do
begin
//如果值为空则指出此值为空
if i=1 then
begin
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD><A HREF="/QUERY/project.exe/DETAILS?id='+ adoquery2.Recordset.Fields[0].Value +'">' + '空值--' +'</A></TD>'
else
RESPONSE.Content:=RESPONSE.Content+'<TD><A HREF="/QUERY/project.exe/DETAILS?id='+ adoquery2.Recordset.Fields[0].Value +'">' + ADOQUERY2.Recordset.Fields[1].Value +'</A></TD>';
end
else if i=5 then
begin
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD>' + '空值--' +'</TD>'
else
RESPONSE.Content:=RESPONSE.Content+'<TD>' + floattostr(ADOQUERY2.Recordset.Fields.Value) +'</TD>';
end
else
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD>' + '空值--' +'</TD>'
else
response.Content:=RESPONSE.Content+'<TD>' + ADOQUERY2.Recordset.Fields.Value +'</TD>';
end;
RESPONSE.Content :=RESPONSE.Content+'</TR>' ;
adoquery2.Next ;
end;
RESPONSE.Content :=RESPONSE.Content+'</TABLE>' ;
end;
adoquery2.Active :=false;
handled:=true;
end;
搞定 ,又方便,又安全,又快捷。
具体实现如下:
用frontpage作一个<form></form>.,用来设定条件
用户提交后 用以下语句读取:
Str_xmbh:=request.ContentFields.Values['xmbh'];
Str_hth:=request.ContentFields.Values['hth'];
Str_xmmc:=request.ContentFields.Values['xmmc'];
Str_fzr:=request.ContentFields.Values['fzr'];
Str_op1:=request.ContentFields.Values['op1'];
Str_qsny:=request.ContentFields.Values['qsny'];
Str_qsny1:=request.ContentFields.Values['qsny1'];
sTR_OP2 :=request.ContentFields.Values ['op2'];
Str_qsny2:=request.ContentFields.Values['qsny2'];
Str_zzny:=request.ContentFields.Values['zzny'];
Str_zzny1:=request.ContentFields.Values['zzny1'];
Str_zzny2:=request.ContentFields.Values['zzny2'];
然后根据读取得信息生成 Sql 语句(这不用多说了吧)
生成SQl以后:
adoquery2.SQL.Clear ;
adoquery2.SQL.Add (str_Sql);
adoquery2.Active :=true;
if adoquery2.Recordset.EOF and adoquery2.Recordset.BOF then
begin
response.Content:='没有记录' ;
end
else
begin
response.Content :=response.Content +'本次查询共查到'+ inttostr(adoquery2.Recordset.RecordCount) +'条记录';
RESPONSE.Content :=RESPONSE.Content +'<table border="1" width="100%">';
adoquery2.Recordset.MoveFirst;
while not adoquery2.Eof do
begin
RESPONSE.Content :=RESPONSE.Content+'<TR>';
//开始循环写入表格
for i:=0 to adoquery2.Recordset.Fields.Count-1 do
begin
//如果值为空则指出此值为空
if i=1 then
begin
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD><A HREF="/QUERY/project.exe/DETAILS?id='+ adoquery2.Recordset.Fields[0].Value +'">' + '空值--' +'</A></TD>'
else
RESPONSE.Content:=RESPONSE.Content+'<TD><A HREF="/QUERY/project.exe/DETAILS?id='+ adoquery2.Recordset.Fields[0].Value +'">' + ADOQUERY2.Recordset.Fields[1].Value +'</A></TD>';
end
else if i=5 then
begin
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD>' + '空值--' +'</TD>'
else
RESPONSE.Content:=RESPONSE.Content+'<TD>' + floattostr(ADOQUERY2.Recordset.Fields.Value) +'</TD>';
end
else
if ADOQUERY2.Fields.IsNull then
RESPONSE.Content:=RESPONSE.Content+'<TD>' + '空值--' +'</TD>'
else
response.Content:=RESPONSE.Content+'<TD>' + ADOQUERY2.Recordset.Fields.Value +'</TD>';
end;
RESPONSE.Content :=RESPONSE.Content+'</TR>' ;
adoquery2.Next ;
end;
RESPONSE.Content :=RESPONSE.Content+'</TABLE>' ;
end;
adoquery2.Active :=false;
handled:=true;
end;
搞定 ,又方便,又安全,又快捷。