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 =
Ïà¹ØÎĵµ£º
(1)char¡¢varchar¡¢textºÍnchar¡¢nvarchar¡¢ntext
charºÍvarcharµÄ³¤¶È¶¼ÔÚ1µ½8000Ö®¼ä£¬ËüÃǵÄÇø±ðÔÚÓÚcharÊǶ¨³¤×Ö·ûÊý¾Ý£¬¶øvarcharÊDZ䳤×Ö·ûÊý¾Ý¡£Ëùν¶¨³¤¾ÍÊdz¤¶È¹Ì¶¨ µÄ£¬µ±ÊäÈëµÄÊý¾Ý³¤¶ÈûÓдﵽָ¶¨µÄ³¤¶Èʱ½«×Ô¶¯ÒÔÓ¢ÎÄ¿Õ¸ñÔÚÆäºóÃæÌî³ä£¬Ê¹³¤¶È´ïµ½ÏàÓ¦µÄ³¤¶È£»¶ø±ä³¤×Ö·ûÊý¾ÝÔò²»»áÒÔ¿Õ¸ñÌî³ä¡£ text´ ......
¡¡×î½üΪÊý¾Ý¿â·þÎñÆ÷Ôö¼ÓÁËÄڴ棬´ïµ½ÁË×î´óÖ§³ÖµÄ8G£¬Êý¾Ý¿âÓõÄÊÇmssql 2005 £¬Ö®Ç°ÄÚ´æÒ»Ö±ÊÇ4GµÄ£¬²»´æÔÚÄÚ´æ´óºÍ32λ²Ù×÷ϵͳ³åÍ»µÄÊÂÇ飬32λ²Ù×÷ϵͳµ¥½ø³Ì×î´óÖ§³Ö2GµÄÄڴ棬ÕâÑù×ӵĻ°ÄÚ´æ¾Í°×¼ÓÁË£¬Ôõô°ìÄØ?
¡¡¡¡ÍøÉÏËÑË÷Á˺ܶà×ÊÁÏ£¬·¢ÏÖ΢ÈíÌṩÁËÒ»¸öËãÊÇÁÙʱµÄ½â¾ö·½°¸°É£¬Ê¹ÓÃAWEÀ´·ÖÅäÄڴ棬ÕâÑù×Ósqlse ......
Êý¾Ý¿âÉè¼Æ¾Ñé̸
Ò»¸ö³É¹¦µÄ¹ÜÀíϵͳ£¬ÊÇÓÉ£º[50% µÄÒµÎñ + 50% µÄÈí¼þ] Ëù×é³É£¬¶ø 50% µÄ³É¹¦Èí¼þÓÖÓÐ [25% µÄÊý¾Ý¿â + 25% µÄ³ÌÐò] Ëù×é³É£¬Êý¾Ý¿âÉè¼ÆµÄºÃ»µÊÇÒ»¸ö¹Ø¼ü¡£Èç¹û°ÑÆóÒµµÄÊý¾Ý±È×öÉúÃüËù±ØÐèµÄѪҺ£¬ÄÇôÊý¾Ý¿âµÄÉè¼Æ¾ÍÊÇÓ¦ÓÃÖÐ×îÖØÒªµÄÒ»²¿·Ö¡£ÓйØÊý¾Ý¿âÉè¼ÆµÄ²ÄÁϺ¹Å£³ä¶°£¬´óѧѧλ¿Î³ÌÀïÒ²ÓÐ ......
YearCode:=yearof(Date);
MonthCode:=monthof(Date);
if MonthCode>9 then
FTime1:=inttostr(YearCode)+inttostr(MonthCode)
else
&nb ......