fastreport´òÓ¡´úÂë¼°SQLºÏ²¢×ֶεÄÓï¾ä
procedure Tform1.Button5Click(Sender: TObject);
var
p:pointer;
FrfStr:string;
begin
inherited;
Screen.Cursor:=MYCURSORWAITHAND;
with cdsPrint do
begin
Active:=false;
//Õâ¸öSQLÓÃÓÚ½«remarkÖеļǼºÏ²¢µ½Ò»Æð!
CommandText:='select a.ITEM_ID, a.ITEM_NAME,count(a.Coll_ID) as num,ltrim(max(sys_connect_by_path(a.remark, '';'')), '';'') remark '
+' from (select /*+index(b,TAB_ORDER_I)*/ b.ITEM_ID,b.Coll_ID,b.ITEM_NAME,b.remark,row_number() over(partition by b.ITEM_ID order by b.ITEM_ID)'
+' ITEM_ID1,row_number() over(order by b.ITEM_ID) + dense_rank() over(order by b.ITEM_ID) ITEM_ID2 '
+' from TAB_ORDER b where b.Coll_ID ='''+DBComboBoxEh1.Text+''''
+' ) a'
+' start with ITEM_ID1 = 1 connect by prior ITEM_ID2 = ITEM_ID2-1 group by a.ITEM_ID,'
+' a.ITEM_NAME order by a.ITEM_ID ';
Active:=true ;
end;
cds_Print.DisableControls;
p:=cdsPrint.GetBookmark;
FrfStr:='report1l.frf';
try
if cdsPrint.Active and (cdsPrint.RecordCount<>0) then
begin
frReport1.LoadfromFile(ExtractFilePath(ParamStr(0))+'Report\'+FrfStr);
PrintSet;
frReport1.ShowReport;
end
else
begin
Screen.Cursor:=crDefault;
Application.MessageBox(pchar(STR_MESSAGEBOX_HEADER+'ûÓÐÊý¾Ý¿É´òÓ¡'),pchar(self.Caption),MB_OK or MB_ICONEXCLAMATION);
end;
finally
cdsPrint.GotoBookmark(p);
cdsPrint.EnableControls;
&nb
Ïà¹ØÎĵµ£º
declare @id varchar(10)
declare @nm varchar(10)
declare @table as table(emp varchar(10),empname varchar(10))
declare CurEmp cursor for select top 6 empid,empname from employee
open CurEmp
fetch next from CurEmp into @id,@nm
While @@fetch_status=0
begin
insert @table(emp,e ......
1.ÀûÓÃÏÂÃæµÄ½Å±¾´´½¨BOOK£¬READER ºÍ BORROW ±í£¬²¢Íê³ÉºóÃæµÄÁªÏµ¡£
CREATE TABLE BOOK(
NO CHAR(8) PRIMARY KEY,
TITLE VARCHAR2(50) NOT NULL,
AUTHOR VARCHAR2(20) ,
PUBLISH VARCHAR2(20),
PUB_DA ......
MS-SQLÖÐsaµÇ¼ʧ°Ü:
¸Ã´íÎó²úÉúµÄÔÒòÊÇÓÉÓÚSQL ServerʹÓÃÁË"½ö Windows"µÄÉí·ÝÑéÖ¤·½Ê½,
Òò´ËÓû§ÎÞ·¨Ê¹ÓÃSQL ServerµÄµÇ¼ÕÊ»§£¨Èç sa £©½øÐÐÁ¬½Ó.½â¾ö·½·¨ÈçÏÂËùʾ:
1.ÔÚ·þÎñÆ÷¶ËʹÓÃÆóÒµ¹ÜÀíÆ÷,²¢ÇÒÑ¡Ôñ"ʹÓà Windows Éí·ÝÑéÖ¤"Á¬½ÓÉÏ SQL Server
²Ù×÷²½Öè:
ÔÚÆóÒµ¹ÜÀíÆ÷ÖÐ
--ÓÒ¼üÄãµÄ·þÎñÆ÷ʵÀý(¾ÍÊÇÄÇ ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊ ......