delphi_sql_Óαê·ÖÒ³_·ÖÒ³dbgrid²éѯ
alter procedure qry_page
@sqlstr nvarchar(4000), --²éѯ×Ö·û´®
@page int, --µÚNÒ³
@pagesize int --ÿҳÐÐÊý
as
declare @rscounts int --¼Ç¼×ÜÊý
declare @pages int --Ò³Ãæ×ÜÊý
set nocount on
declare @P1 int --P1ÊÇÓαêµÄid
exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1,@RecordCount=@rscounts output
set @pages = ceiling(1.0*@rscounts/@pagesize)
if @page<=0 set @page=1
if @page>@pages set @page=@pages
--µ±Ç°Ò³ÃæÌõÊý£¬²»×ãÒ»Ò³
declare @curpg_counts int
if @rscounts<@page*@pagesize
set @curpg_counts=@rscounts-(@page-1)*@pagesize
else
set @curpg_counts=@pagesize
--µ±Ç°Ò³ÆðʼÐÐ,´Ó1¿ªÊ¼
declare @startPos int
set @startPos=(@page-1)*@pagesize+1
--»ñÈ¡Ö¸¶¨¼Ç¼
exec sp_cursorfetch @P1,16,@startPos,@curpg_counts
exec sp_cursorclose @P1
set nocount off
--ÁíÍâ·µ»Ø¼Ç¼×ÜÊý/×ÜÒ³ÃæÊý/µ±Ç°Ò³/ÿҳÌõÊý
select rscounts=@rscounts,pages=@pages,pagesize=@pagesize,page=@page
--exec qry_page 'select * from user_record_in order by id',3,5
¿Í»§¶Ë·ÃÎʳÌÐò
delphi°æ±¾:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, ExtCtrls, DB, ADODB, Mask;
type
TForm1 = class(TForm)
Panel1: TPanel;
DBGrid1: TDBGrid;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
Label5: TLabel;
SpeedButton1: TSpeedButt
Ïà¹ØÎĵµ£º
ʹÓÃHIBERNATEµÄSQL²éѯ²¢½«½á¹û¼¯×Ô¶¯×ª»»³ÉPOJO
ÎÄÕ·ÖÀà:Java±à³Ì
ÔÚijЩ³¡ºÏÏ£¬ÎÒÃÇ¿ÉÄÜÏëʹÓÃHIBERNATEµÄ¿ò¼ÜÌṩµÄSQL²éѯ½Ó¿Ú£¬Õâʱ£¬ÓÉÓÚ±íºÍʵÌ嶼¿ÉÄÜûÓÐ×öÓ³É䣬HIBERNATE²»Äܰѽá¹û¼¯×ª»»
³ÉÄãÏëÒªµÄList<POJO>£¬±¾ÎÄÌÖÂÛÈçºÎÔÚÕâÖÖÇé¿öÏÂÈÃHIBERNATEÖ±½Ó·µ»ØÄãÏëµÄ½ ......
Àí½âSQL SERVERÖÐËùÓÐÕߺͼܹ¹µÄÇø±ð
SQL SERVER2005½éÉÜÁ˼ܹ¹£¬¼Ü¹¹Ïà¶ÔÓÚÒÔÇ°°æ±¾ÖеĶÔÏóËùÓÐÕß¡£±¾ÎĽ«½âÊÍÕâÁ½ÕßµÄÇø±ð£¬²¢Ï£ÍûÄܽ⿪ÄãÖÁ½ñÈԶԼܹ¹Ò»µãÀ§»ó¡£
¶ÔÏóËùÓÐÕß
ÒªÀí½âËùÓÐÕߺͼܹ¹Ö®¼äµÄÇø±ð£¬ÈÃÎÒÃÇÏÈ»¨µãʱ¼äÀ´¸´Ï°Ò»Ï¶ÔÏóµÄËùÓÐȨ¡£ÔÚSQL SERVER2000»òÒÔÇ°°æ±¾Öд´½¨Ò»¸ö¶ÔÏ󣬶ÔÏó±ØÐëÒªÓÐÒ»¸öËù ......
string s = " 80,81,83,82";
string[] s1 = s.Split(',');
int[] p = new int[s1.Count()];
for (int i = 0; i < s1.Count( ......
1.°´ÐÕÊϱʻÅÅÐò: Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.Êý¾Ý¿â¼ÓÃÜ: select encrypt('ÔʼÃÜÂë') select pwdencrypt('ÔʼÃÜÂë') select pwdcompare('ÔʼÃÜÂë','¼ÓÃܺóÃÜÂë') = 1--Ïàͬ£»·ñÔò²»Ïàͬ
3.È¡»Ø±íÖÐ×Ö¶Î: declare @list varchar(1000),@sql nvarchar(1000)&n ......
ÉϽÚÎÒÃǽéÉÜÁ˱íÁ¬½Ó£¬¸üÈ·ÇеÄ˵ÊÇinner joins內Á¬½Ó£®
¡¡¡¡內Á¬½Ó½öÑ¡³öÁ½ÕűíÖл¥ÏàÆ¥ÅäµÄ¼Ç¼£®Òò´Ë£¬Õâ»áµ¼ÖÂÓÐʱÎÒÃÇÐèÒªµÄ¼Ç¼ûÓаüº¬½øÀ´¡£
¡¡¡¡Îª¸üºÃµÄÀí½âÕâ¸ö¸ÅÄÎÒÃǽéÉÜÁ½¸ö±í×÷ÑÝʾ¡£ËÕ¸ñÀ¼Òé»áÖеÄÕþµ³±í(party)ºÍÒéÔ±±í(msp)¡£
party(Code,Name,Leader)
Code: Õþµ³´úÂë
Name: Õþµ³ ......