Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL ºÍ´æ´¢¹ý³Ì¼¶±ðµÄÊÂÎñ¼°ADO.NET¼¶±ðµÄÊÂÎñ

 Êý¾Ý¿âÊÂÎñÊÇÆäËûÊÂÎñÄ£Ð͵Ļù´¡£¬µ±Ò»¸öÊÂÎñ´´½¨Ê±²»Í¬Êý¾Ý¿âϵͳ¶¼ÓÐ×Ô¼ºµÄ¹æ
Ôò¡£SQL Server ĬÈÏÔÚ×Ô¶¯Ìá½»µÄģʽϹ¤×÷£¬Ã¿¸öÓï¾äÖ´ÐÐÍêºó¶¼»áÁ¢¼´Ìá½»£»Óë´Ë¶ÔÕÕ
µÄÊÇ Oracle ÐèÒªÄã°üº¬Ò»¸öÌá½»Óï¾ä¡£µ«Êǵ±Ò»¸öÓï¾äͨ¹ý OLE  DB Ö´ÐÐʱ£¬ËüÖ´ÐÐÍêºó
Ò»¸öÌá½»¶¯×÷»á±»¸½¼ÓÉÏÈ¥¡£ÀýÈ磺
DECLARE  @TranName  VARCHAR(20);
SELECT  @TranName  =  'MyTransaction';
 
BEGIN  TRANSACTION  @TranName;
GO
USE  AdventureWorks;
GO
DELETE  from  AdventureWorks.HumanResources.JobCandidate
        WHERE  JobCandidateID  =  13;
GO
 
COMMIT  TRANSACTION  MyTransaction;
GO
»òÕߣº
CREATE  PROCEDURE  Tran1  
as  
begin  tran   
set  xact_abort  on 
Insert  Into  P_Category(CategoryId,Name)values('1','test1')  
Insert  Into  P_Category(CategoryId,Name)values('2','test2')  
commit  tran   
GO
set xact_abort on±íʾÓöµ½´íÎóÁ¢¼´»Ø¹ö¡£
µ±È»ÄãÒ²¿ÉÒÔÕâôд£º
CREATE  PROCEDURE  tran1 
as 
begin  tran 
Insert  Into  P_Category(CategoryId,Name)values('1','test1')  
if(@@error<>0) 
  rollback  tran 
else 
  begin 
   Insert  Into  P_Category(CategoryId,Name)values('2','test2')
   if(@@error<>0) 
      rollback  tran 
   else 
      commit  tran 
  end 
GO
ADO.NET¼¶±ðµÄÊÂÎñ
string  conString  =  "data  source=127.0.0.1;database=codematic;user  id=sa;
password=";
SqlConnection  myConnection  =  new  SqlConnection(conString);
myConnection.Open();
 
//Æô¶¯Ò»¸öÊÂÎñ
SqlTransaction  myTrans  = 


Ïà¹ØÎĵµ£º

sqlÖеÄÓαê

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 ......

sql sa怬

 ÎÊÌâÒ»¡¢Íü¼ÇÁ˵ǼMicrosoft SQL Server 2005 µÄsaµÄµÇ¼ÃÜÂë
½â¾ö·½·¨£ºÏÈÓÃwindowsÉí·ÝÑéÖ¤µÄ·½Ê½µÇ¼½øÈ¥£¬È»ºóÔÚ‘°²È«ÐÔ’-‘µÇ¼’-ÓÒ¼üµ¥»÷‘sa’-‘ÊôÐÔ’£¬ÐÞ¸ÄÃÜÂëµã»÷È·¶¨¾Í¿ÉÒÔÁË¡£
ÎÊÌâ¶þ¡¢Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹ ......

жÔØSQL Server 2005

 ÔÚжÔØVisual Studio 2008 ʱ£¬Ìí¼Ó/ɾ³ý³ÌÐò ÀïÃæÓÐÐí¶àµÄ°²×°Îļþ£¬´ËʱÈç¹ûûÓÐÏÈжÔØSQL Server 2005 £¬
¶øÏÈжÔØ.Net Framework£¨Ìáʾ£ºÐ¶ÔØ.net FrameworkµÄµÃ°²°æ±¾´Ó¸ßµ½µÍµÄ˳Ðò£©£¬
ÕâʱSQL Server 2005¾Í²»ÄÜжÔØ,ɾ³ýProgram files ÏÂÃæµÄ Microsoft SQL Server Îļþ¼ÐҲûÓÐ×÷Óá£
ÖØа²×°ÌáʾÊý¾Ý¿ ......

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ÖеļǼºÏ²¢µ½Ò»Æ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ