关于按时间段查询的问题 select * from table where sometime > '2001-01-01' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看看下面代码有一个条件是按时间的。procedure TF_3.Button1Click(Sender: TObject);Var Conditions , B_name , OptionChar , FieldName : String ; BeginT , EndT , UseT : Real ;begin FieldName := 'blid as 病历号 , bpatid as 检查号 ' ; for i := 0 to Length( Field ) - 1 do begin if Field[i].useed then FieldName := FieldName + ' , ' + Field[i].field_en + ' as ' + Field[i].field_china ; end ; //Delete( FieldName , Length( FieldName ) - 1 , 1 ) ;// if FieldName = '' then// FieldName := 'bpatname as 病人姓名' ; //ShowMessage( FieldName ) ; OptionChar := SpeedButton5.Caption ; B_name := Edit20.Text ; F_0.DataSource1.DataSet := F_0.ADOQuery1 ; Conditions := ' and ( bdate ' + OptionChar + '''' + DateToStr( DateTimePicker1.Date ) + '''' ; if B_name = '' then Conditions := Conditions + ')' else begin if CheckBox1.Checked then Conditions := Conditions + ' and bpatname like ' + '''' + '%' + B_name + '%' + '''' + ' )' else Conditions := Conditions + ' and bpatname = ' + '''' + B_name + '''' + ' )' ; end ; BeginT := GetTickCount ; With F_0.ADOQuery1 do begin Close ; SQL.Clear ; if F_1.LoginParameters.UserName = '超级管理员' then SQL.Add( 'select count(blid) from history where bdrname <> ' + '''' + '''' + Conditions ) else SQL.Add( 'select count(blid) from history where bdrname like ' + '''' + '%' + F_1.LoginParameters.UserName + '%' + '''' + Conditions );// ShowMessage( SQL.Text ) ; Open ; Label3.Caption := '数目:' + Fields[0].AsString + ' 条' ; end ; With F_0.ADOQuery1 do begin Close ; SQL.Clear ; if F_1.LoginParameters.UserName = '超级管理员' then SQL.Add( 'select ' + FieldName + ' from history where bdrname <> ' + '''' + '''' + Conditions ) else SQL.Add( 'select ' + FieldName + ' from history where bdrname like ' + '''' + '%' + F_1.LoginParameters.UserName + '%' + '''' + Conditions );// ShowMessage( SQL.Text ) ; Try Open ; Except Application.MessageBox( '您的查询失败,原因可能是某列无效!' , '提示' , MB_OK + MB_ICONINFORMATION ) ; End ; end ; EndT := GetTickCount ; UseT := EndT - BeginT ; UseT := Round( ( UseT / 1000 ) * 100 ) / 100 ; Label11.Caption := '【' + CurrToStr( UseT ) + ' 秒】' ;end; combobox.item与edit.text内容一致,该怎么写呢 明天回家準備結婚,散分 *******关于密码键盘的问题 有没有熟悉IdTCPServer的帮忙一下 C/S 如何在无盘网络中广泛应用? UDPClient怎么接受数组数据包?? delphi6用ADO如何边接ORACLE9I的数据库 reportbuilder里如何定义数组 如何在程序里修改任务栏“总在最前”的这一属性值? 请教一个DELPHI5的小问题 求助,同步跟异步的程序怎么写? 怎样将adouqery中的记录导入到excel中?
Var
Conditions , B_name , OptionChar , FieldName : String ;
BeginT , EndT , UseT : Real ;
begin
FieldName := 'blid as 病历号 , bpatid as 检查号 ' ;
for i := 0 to Length( Field ) - 1 do begin
if Field[i].useed then
FieldName := FieldName + ' , ' + Field[i].field_en + ' as ' + Field[i].field_china ;
end ;
//Delete( FieldName , Length( FieldName ) - 1 , 1 ) ;// if FieldName = '' then
// FieldName := 'bpatname as 病人姓名' ;
//ShowMessage( FieldName ) ;
OptionChar := SpeedButton5.Caption ;
B_name := Edit20.Text ;
F_0.DataSource1.DataSet := F_0.ADOQuery1 ;
Conditions := ' and ( bdate ' + OptionChar + '''' + DateToStr( DateTimePicker1.Date ) + '''' ;
if B_name = '' then
Conditions := Conditions + ')'
else begin
if CheckBox1.Checked then
Conditions := Conditions + ' and bpatname like ' + '''' + '%' + B_name + '%' + '''' + ' )'
else
Conditions := Conditions + ' and bpatname = ' + '''' + B_name + '''' + ' )' ; end ;
BeginT := GetTickCount ;
With F_0.ADOQuery1 do begin
Close ;
SQL.Clear ;
if F_1.LoginParameters.UserName = '超级管理员' then
SQL.Add( 'select count(blid) from history where bdrname <> ' + '''' + '''' + Conditions )
else
SQL.Add( 'select count(blid) from history where bdrname like ' + '''' + '%' + F_1.LoginParameters.UserName + '%' + '''' + Conditions );
// ShowMessage( SQL.Text ) ;
Open ;
Label3.Caption := '数目:' + Fields[0].AsString + ' 条' ;
end ; With F_0.ADOQuery1 do begin
Close ;
SQL.Clear ;
if F_1.LoginParameters.UserName = '超级管理员' then
SQL.Add( 'select ' + FieldName + ' from history where bdrname <> ' + '''' + '''' + Conditions )
else
SQL.Add( 'select ' + FieldName + ' from history where bdrname like ' + '''' + '%' + F_1.LoginParameters.UserName + '%' + '''' + Conditions );
// ShowMessage( SQL.Text ) ;
Try
Open ;
Except
Application.MessageBox( '您的查询失败,原因可能是某列无效!' , '提示' , MB_OK + MB_ICONINFORMATION ) ;
End ;
end ; EndT := GetTickCount ;
UseT := EndT - BeginT ;
UseT := Round( ( UseT / 1000 ) * 100 ) / 100 ;
Label11.Caption := '【' + CurrToStr( UseT ) + ' 秒】' ;
end;