SQL²éѯ·ÖÎöÆ÷Íâ¹ÒÔ´Âë·ÖÏí
±¾ÈËдÁËÒ»¸öSQL²éѯ·ÖÎöÆ÷À©Õ¹¹¤¾ß£¬¹¦ÄÜÀàËÆDelphiµÄToDo¡£¿ÉÒÔ·½±ã¿ª·¢ÕßÔÚ´óÁ¿µÄSQL½Å±¾ÖпìËÙÕÒµ½Ã¿¸öÄ£¿é¡¢To-Do£¬´Ó¶øÌá¸ß¿ª·¢¸ßÀûÂÊ¡£
ʹÓõÄʱºòÏÈÔËÐÐSQL²éѯ·ÖÎöÆ÷£¬È»ºóÔËÐб¾³ÌÐò¼´¿É£¨¿ÉÒÔ¹¤¾ß|×Ô¶¨ÒåÖÐÅäÖã©¡£°´F2ÏÔʾTo-Do List´°¿Ú£¬°´Alt+F2ÔÚµ±Ç°Î»ÖòåÈëTo-Do¡£
ÓÉÓÚʱ¼ä¹ØÏµ£¬±¾³ÌÐò²¢Î´ÍêÉÆ£¬ÔÚË«»÷To-Do ItemºóӦûÓн«¹â±ê¶¨Î»µ½¶ÔÓ¦µÄλÖã¬Ï£Íû¸ßÊִͽ̣¬ÓÐÐËȤµÄÅóÓѲ»·À¼ÌÐøÍêÉÆËü£¬²¢·¢Ò»·ÝÔ´Âë¸øÎÒ¡£Íò·Öлл¡££¨QQ£º462400756£©
{================================================================}
{ todo.dpr
{================================================================}
program todo;
{%ToDo 'todo.todo'}
uses
Forms,
windows,
messages,
tdmain in 'tdmain.pas' {frmToDoMain},
tdcontainer in 'tdcontainer.pas' {frmContainer},
tdItem in 'tdItem.pas' {frmItem},
tdFilter in 'tdFilter.pas' {frmFilter};
{$R *.res}
var
h: Hwnd;
begin
Application.Initialize;
h := FindWindow(nil, PChar('frmContainer'));
if h = 0 then
begin
Application.CreateForm(TfrmContainer, frmContainer);
Application.CreateForm(TfrmToDoMain, frmToDoMain);
Application.CreateForm(TfrmItem, frmItem);
Application.CreateForm(TfrmFilter, frmFilter);
Application.ShowMainForm := False;
end;
h := FindWindow(nil, PChar('frmContainer'));
SendMessage(h, WM_RERUN, 0, 0);
Application.Run;
end.
{================================================================}
{ tdmain.pas
{================================================================}
unit tdmain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, RegExpr, Tabs, Menus, StdCtrls, ImgList,
Grids, ExtCtrls;
type
TViewType = (vtTodo, vtModule);
TGroupType = (gtOwner, gtCategory);
TfrmToDoMain = class(TForm)
 
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Ò»¡¢¾ßÓÐÖ÷¼üµÄÇé¿ö
I.¾ßÓÐΨһÐÔµÄ×Ö¶Îid(ΪΨһÖ÷¼ü)
delete Óû§±í
where id not in
(
select max(id) from Óû§±í group by col1,col2,col3...
)
group by ×Ó¾äºó¸úµÄ×ֶξÍÊÇÄãÓÃÀ´ÅжÏÖØ¸´µÄÌõ¼þ£¬ÈçÖ»ÓÐcol1£¬
ÄÇôֻҪcol1×Ö¶ÎÄÚÈÝÏàͬ¼´±íʾ¼Ç¼Ïàͬ¡£
II. ......
sql server
Ìæ»»null:isnull(arg,value)
Èç:select isnull(price,0.0) from orders ,Èç¹ûpriceΪnullµÄ»°£¬ÓÃ0 ......
ÔÚSQL SERVERÖУ¬Äã¿ÉÄÜÐèÒª»ñµÃµ±Ç°ÈÕÆÚºÍ¼ÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃǴ󲿷ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâÆªÎÄÕÂÀÎÒ½«¸æËßÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆË ......
ÔÚ²éѯ·ÖÎöÆ÷ÒÔ“Îı¾ÏÔʾ½á¹û”·½·¨Ö´ÐÐ
exec UspOutputData ÄãµÄ±íÃû
µÃµ½µ¼³öÊý¾ÝµÄÓï¾ä£¬µ«image,text,ntext,sql_variant Áв»³öÏÖÔÚÓï¾ä£¬ÒÔºó¸Ä½ø¡£
´æ´¢¹ý³ÌUspOutputDataÈçÏ£º
CREATE PROCEDURE  ......