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

·À·¶sql×¢Èë¹¥»÷£¨ÉÏ£©

ͬ²½Ò»ÏÂÎÒbaiduµÄblog£ºhttp://hi.baidu.com/ncheng/blog/item/bc65f82a1a6a7c335343c11c.html
Sql×¢ÈëÊÇÒ»ÖÖÈëÃż«µÍÆÆ»µ¼«´óµÄ¹¥»÷·½Ê½¡£Èç¹ûsqlÊÇÓÃ×Ö·û´®Æ´½Ó³öÀ´µÄ»°£¬ÄÇô¿Ï¶¨»á±»×¢Èë¹¥»÷£¬Ç°¶Îʱ¼ä»¹´«³öÁËij¹úÍâ´óÐÍÉç½»ÍøÕ¾±»SQL×¢Èë¹¥»÷¡£
Sql×¢Èë¹¥»÷µÄ·½Ê½£¬À´ÕâÀï¿´µÄͬ־ÃÇÓ¦¸ÃºÜÇå³þÁË£¬¾ÍÊÇÔÚÆ´½Ó×Ö·û´®µÄʱºò£¬Èç¹ûÊäÈëµÄÊÇ´øµ¥ÒýºÅµÄ£¬ÄÇôÊäÈëlaf' or 1='1' --ÕâÑù¾Í»áÌÓ±ÜÌõ¼þ¼ì²é£¬ºóÃæÒªÊÇÔÙ¸úһЩshutdown£¬deleteÖ®ÀàµÄÌõ¼þ£¬ÄÇôËðʧ»ù±¾ËãÊÇ»ÙÃðÐÔµÄÁË¡£Ç°¼¸Ì쵥λ¿ª·¢µÄ¹ý³ÌÖÐÎÒ·¢ÏÖ¼¸ºõ´ó¼Ò¶¼²»ÖØÊÓ°²È«£¬Ò»¸öд´úÂëµÄÈ˲»×¢ÒⰲȫֻעÒâʵÏÖÄÇôд³öÀ´µÄ´úÂëÔÚ¹¥»÷ÕßÑÛÇ°»ù±¾¾ÍÊÇÒ»¸öûÓд©Ò·þµÄÃÀÅ®¡£
ÏÂÃæÊÇÎÒÒ»¸ö¿ª·¢ÈËÔ±µÄһЩ¾­Ñ飬Ö÷ÒªÓÃÀ´·ÀÖ¹sql×¢Èë¡£
1¡¢Ê×ÏȶÔÔËÐÐsqlµÄÓû§¸³Óè×îСȨÏÞ£¬Õâ¸öÀíÂÛÒ²ÊÇ°²È«ÁìÓòµÄ×îСÌØȨÀíÂÛ£¬ÔËÐÐÒ»¸ö³ÌÐòÒ»¶¨ÒªÓÃ×îСÌØȨÔËÐУ¬ËùÒÔ²»Òª¸øÓû§·þÎñDBAµÄȨÏÞ£¬ÏÞÖÆҪȨÏÞÖ®ºó¿ÉÒÔ·ÀֹһЩ»ÙÃðÐԵĹ¥»÷£¬¼´Ê¹¹¥ÈëÁËÒ²²»»áshutdownÐ޸ıíÖ®ÀàµÄ¡£
2¡¢Ò»¶¨²»ÒªÊ¹ÓÃ×Ö·û´®Æ´½ÓµÄ·½Ê½¹¹Ôìsql£¬±ØÐëʹÓòÎÊý»¯sql£¬´æ´¢¹ý³Ì¿ÉÒÔ¿´×÷ÊDzÎÊýsql£¬¼òµ¥µÄ¾ÍÖ±½Ó¹¹Ôì²ÎÊý»¯sql£¬¸´ÔӵľÍд´æ´¢¹ý³Ì£¬²»¹ý´æ´¢¹ý³ÌÖÐÒ»¶¨²»ÒªÓÃ×Ö·û´®£¬ÎÒ¿´ÓÐÈËÔÚ´æ´¢¹ý³ÌÓÃ×Ö·û´®£¬ÕâÑù»¹ÊDz»ÄܱÜÃâ±»¹¥»÷£¬²¢ÇÒÔÚµ÷ÊÔµÄʱºò·Ç³£Âé·³¡£
3¡¢ÑÏ°ÑÊäÈë¹Ø£¬ÏµÍ³¿Ï¶¨ÊÇÓÃÀ´½»»¥µÄ£¬ËùÓÐÓû§ÊäÈëµÄÕâÒ»¹ØÒ»¶¨Òª°ÑºÃ£¬¿ÉÒÔÀûÓø÷ÖÖ·½Ê½À´¼ìÑéÓû§µÄÊäÈ룬ÈÃÊäÈ붼ÊǺϷ¨µÄ£»¿ÉÒÔÉèÃô¸Ð×Ö·û²»ÈÃÓû§ÊäÈ룬Õâ¸öËäÈ»²»ÊǺÜÓѺ㬲»¹ý¶ÔÓ밲ȫÓб£Ö¤¡£ÔÚÑéÖ¤µÄÊÇ¿ÉÒÔÓÃÕýÔò±í´ïʽ»òÕß³ÌÐòÑéÖ¤£¬²»¹ÜÓÃʲô·½Ê½Ö»Òª°ÑÃô¸Ð×Ö·ûºÍ¿ÉÒÉ×Ö·û¾ÜÖ®ÃÅÍâÄÇô¾ÍÎÞ·¨¹¥»÷ÁË£¬²»¹ýÏÞÖÆÊäÈ뻹ÊÇÓÐȱÏÝ£¬ÔÚ°²È«ÀíÂÛ·½Ã棬ֻÄÜÈ·¶¨ºÏ·¨£¬²»ÄÜÈ·¶¨²»ºÏ·¨£¬±ÈÈçÄãÔÚ½çÃæÏÞÖÆÁ˺Ϸ¨µÄ£¬ÄÇôʣÓàµÄ¶¼ÊDz»ºÏ·¨µÄ£¬ÕâʱºòÊäÈëµÄ¿Ï¶¨È«²¿ÊǺϷ¨µÄ£¬Èç¹ûÄãÏÞÖƵÄÊÇ·Ç·¨µÄ£¬¿ÉÊÇÄãÄÜÈ·±£ÄãÏÞÖƵÄÈ«ÊÇ·Ç·¨µÄ£¿Èç¹ûijһÌì·¢ÏÖÒ»¸ö·Ç·¨µÄ²»ÔÙÄãÏÞÖÆÖ®ÄÚÄÇôÄã¾Í»á±»¹¥»÷¡£
4¡¢×öºÃ×Ô¼ºµÄ¼ìÑéºÍ²âÊÔ¹¤×÷£¬×Ô¼º¿ÉÒÔ½øÐÐsql×¢Èë¹¥»÷£¬ÀûÓù¤¾ß¼ìÑé¡£
5¡¢Ò»¶¨ÒªÑø³É¾ßÓа²È«ÒâʶµÄ³ÌÐòÔ±£¬Ê±¿ÌÏë×Å°²È«¡£
 
Õ⼸ÌõÖ®ÖÐ×îÖØÒªµÄÊÇ1ºÍ2£¬È¨ÏÞÏÞÖÆÒ»¶¨Òª×¢Ò⣬²»È»»áËÀµÄºÜ²ÒµÄ£¬µÚ¶þ¾ÍÊdzÌÐòÔ±µÄÏ°¹ßÁË£¬Ò»¶¨ÒªÓòÎÊý»¯sqlºÍÊý¾Ý¿â½»»¥¡£
 
ʱ¼äÌ«ÍíÁË£¬Ã÷Ì컹ҪÉÏ°àÄØ£¬¾Íµ½ÕâÀï°É£¬ÏÂһƪÎÒ¾Íͨ¹ýʵÀýÀ´ËµËµ³ÌÐòÔ±×î¹ØÐĵ


Ïà¹ØÎĵµ£º

asp.net(C#)ʵÏÖSQL2000Êý¾Ý¿â±¸·ÝºÍ»¹Ô­

asp.net(C#)ʵÏÖSQL2000Êý¾Ý¿â±¸·ÝºÍ»¹Ô­
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......

C#ÓëSQL Server 2000ʵÏÖÎÞÏÞ¼¶²Ëµ¥


//tree.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Syst ......

²éѯ´æ´¢¹ý³ÌµÄ²ÎÊýÐÅÏ¢µÄSQLÓï¾ä

declare @SchemaName nvarchar(50)
set @SchemaName='dbo'
declare @CommandName nvarchar(50)
set @CommandName='spName'
SELECT
                DB_NAME() AS [PROCEDURE_CATALOG],
         ......

ʹÓÃSQLÓï¾ä

ʹÓÃSQLÓï¾ä
        SQLÓïÑÔ°üÀ¨Êý¾Ý²éѯÓïÑÔ(SELECT)¡¢Êý¾Ý²Ù×ÝÓïÑÔ(INSERT¡¢UPDATE¡¢DELETE)¡¢ÊÂÎñ¿ØÖÆÓïÑÔ(COMMIT¡¢ROLLBACK¡¢SAVEPOINT)¡¢Êý¾Ý¶¨ÒåÓïÑÔ(CREATE TABLE¡¢ALTER TABLE¡¢DROP)¡¢Êý¾Ý¿ØÖÆÓïÑÔ(GRANT¡¢REVOKE)µÈÎå¸ö²¿·Ö¡£
µ±±àдPL/SQLÓ¦ÓóÌÐòʱ£¬Ö»ÄÜÖ±½ÓǶÈëSELECT ......

ms sql Ò»´Î²åÈë¶àÌõ¼Ç¼µÄÓï¾ä

ÓеÄʱºòÎÒÃÇÐèÒªÒ»´ÎÏñÊý¾Ý¿âÖÐÌí¼Ó¶àÌõ¼Ç¼£¬ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄÓï¾äÀ´ÊµÏÖ£º
--Ìí¼ÓÒ»Ìõ¼Ç¼
INSERT INTO tableName(col1,col2,col3) VALUES (1,2,3)
--Ìí¼Ó¶àÌõ¼Ç¼
INSERT INTO tableName(col1,col2,col3)
SELECT 3,4,5
UNION ALL
SELECT 6,7,8
--´ÓÁíÍâµÄÒ»ÕűíÖжÁÈ¡¶àÌõÊý¾ÝÌí¼Óµ½Ð±íÖÐ
INSERT INTO tabl ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ