ÈçºÎÓ¦¶ÔWinformsÖÐSQLµÄ×¢Èëʽ¹¥»÷
SqlÓï¾ä×÷Ϊ¹ú¼Ê±ê×¼µÄÊý¾Ý¿â²éѯÓï¾ä£¬±±¾©°á¼Ò¹«Ë¾ ±±¾©Êèͨ¹«Ë¾ÔÚ¸÷ÖÖ±à³Ì»·¾³Öеõ½Á˹㷺µÄÓ¦Óá£×÷Ϊһ¸ö³ÉÊì¡¢Îȶ¨µÄϵͳ£¬Óû§µÇ½ºÍÃÜÂëÑéÖ¤ÊDZز»¿ÉÉٵġ£ÔÚƽʱµÄ±à³Ì¹¤×÷ÖÐÐí¶à³ÌÐòÔ±ÔÚÓÃsqlÓï¾ä½øÐÐÓû§ÃÜÂëÑé֤ʱÊÇͨ¹ýÒ»¸öÀàËÆÕâÑùµÄÓï¾äÀ´ÊµÏֵģº
strSel = " Select * from Óû§±í where ÐÕÃû= '" + name + "' and ÃÜÂë = '" + password + "'";
ÆäÖÐnameºÍpasswordÊÇ´æ·ÅÓû§ÊäÈëµÄÓû§ÃûºÍ¿ÚÁͨ¹ýÖ´ÐÐÉÏÊöÓï¾äÀ´ÑéÖ¤Óû§ºÍÃÜÂëÊÇ·ñºÏ·¨ÓÐЧ¡£µ«ÊÇͨ¹ý·ÖÎö¿ÉÒÔ·¢ÏÖ£¬ÉÏÊöÓï¾äÈ´´æÔÚ×ÅÖÂÃüµÄ©¶´¡£µ±ÎÒÃÇÔÚÓû§Ãû³ÆÖÐÊäÈëÏÂÃæµÄ×Ö·û´®Ê±£º111 ' or '1 = 1£¬È»ºó¿ÚÁîÒ²ÒÔÀàËÆ·½·¨ÊäÈ룬ÎÒÃǼÙÉèÃÜÂëΪaaaa¡£±äÁ¿´ú»»ºó£¬sqlÓï¾ä¾Í±ä³ÉÁËÏÂÃæµÄ×Ö·û´®£º Sql="Select * from Óû§±í where ÐÕÃû = '111' or '1' = '1' and ÃÜÂë = 'aaaa'
ÎÒÃǶ¼ÖªµÀselectÓï¾äÔÚÅжϲéѯÌõ¼þʱ£¬Óöµ½»ò£¨or£©²Ù×÷¾Í»áºöÂÔÏÂÃæµÄÓ루and£©²Ù×÷£¬¶øÔÚÉÏÃæµÄÓï¾äÖÐ1=1µÄÖµÓÀԶΪtrue£¬ÕâÒâζ×ÅÎÞÂÛÔÚÃÜÂëÖÐÊäÈëʲôֵ£¬¾ùÄÜͨ¹ýÉÏÊöµÄÃÜÂëÑéÖ¤£¡Õâ¸öÎÊÌâµÄ½â¾öºÜ¼òµ¥£¬·½·¨Ò²ºÜ¶à£¬×î³£ÓõÄÊÇÔÚÖ´ÐÐÑé֤֮ǰ£¬¶ÔÓû§ÊäÈëµÄÓû§ºÍÃÜÂë½øÐкϷ¨ÐÔÅжϣ¬±±¾©°á¼Ò¹«Ë¾ ±±¾©Êèͨ¹«Ë¾²»ÔÊÐíÊäÈëµ¥ÒýºÅ¡¢µÈºÅµÈÌØÊâ×Ö·û¡£
ÉÏÊöÎÊÌâËäÈ»¿´ÆðÀ´¼òµ¥£¬µ«È·ÊµÊÇ´æÔڵġ£ÀýÈçÔÚ»¥ÁªÍøÉϺÜÓÐÃûÆøµÄÍøÂçÓÎÏ·"Ц°Á½ºþ"µÄÔçÆÚ°æ±¾¾Í´æÔÚ×ÅÕâÑùµÄÎÊÌ⣬ÕâȷʵӦ¸ÃÒýÆðÎÒÃǵÄ×¢Òâ¡£ÕâÒ²±©Â¶³öÄêÇá³ÌÐòÔ±ÔÚ±à³Ì¾ÑéºÍ°²È«ÒâʶÉϵIJ»×㡣ͬʱҲÌáÐÑÎÒÃDZà³Ì¹¤×÷ÕßÔÚ³ÌÐòÉè¼ÆʱӦµ±³ä·Ö¿¼ÂdzÌÐòµÄ°²È«ÐÔ£¬²»¿ÉÓаëµãÂí»¢£¬Ò»¸ö¿´ËƺÜСµÄÊè©¿ÉÄܾͻáÔì³ÉºÜÑÏÖصĺó¹û¡£ ÔÚWinforms±à³ÌÖпÉÒÔ²ÉÈ¡ÒÔÏ·½·¨½â¾ö£¬¿ÉÒÔÓÃÎı¾¿òµÄKeyPressʼþÖÐÌí¼ÓÒÔÏ´úÂë
if(e.KeyChar == ' \' ') {
MessageBox.Show("²»¿ÉÒÔÊäÈë‘£¡");
e.Handled = true;
}±±¾©°á¼Ò¹«Ë¾ ±±¾©Êèͨ¹«Ë¾
´Ë´¦µÄeÊǸÃʼþÌṩµÄ²ÎÊý¶ÔÏó£¬KeyCharÊDZíʾËù°´¼üµÄASCIIÂ룬\'±íʾµ¥ÒýºÅ£¬Ìõ¼
Ïà¹ØÎĵµ£º
¡¡¡¡Ä¿µÄ£º½«Êý¾ÝÅúÁ¿µ¼ÈëÔ¶³Ì·þÎñÆ÷
¡¡¡¡»·¾³£ºSQLÈí¼þ£¬EXCELÈí¼þ£¬VS2005Èí¼þ£¬±¾µØÁ½¸ö»úÆ÷É϶¼ÓÐSQLÊý¾Ý¿â£¬¶øÇÒÊý¾Ý´æ·ÅÔÚÆäÖÐÒ»¸ö±í¡£
¡¡¡¡²Ù×÷ʵ¼ù
¡¡¡¡1¡¢ÓÃÔ¶³ÌÊý¾Ý¿âµÄip¡¢Óû§Ãû¡¢ÃÜÂëÔÚ±¾µØµÇ¼£»
¡¡¡¡2¡¢½á¹û£¬ÆäÖÐÒ»¸ö»úÆ÷ÄܵǼ£¬Ò»¸ö²»ÄܵǼ£¨ÒÔϲÙ×÷ÔڿɵǼµÄ»úÆ÷ÉÏÍê³É£©£»
¡¡¡¡3¡¢µÚÒ»´ÎÎÒÏëͨ ......
select sql_text, spid, v$session.program, process
from v$sqltext, v$session, v$process
where v$sqltext.address = v$session.sql_address
and v$sqltext.hash_value = v$session.sql_hash_value
and v$session.paddr = v$process.addr
and v$process.spid in (4335);
×¢Ò ......
SQl XmlºÍC# XmlÊý¾ÝµÄÒ»µã²Ù×÷×ܽá
ÔÚ´ËÉêÃ÷XmlÊÇInfoSetÊý¾Ý²»ÊÇ×Ö·û´®£¬ËùÒÔÔÚ´ËÇ¿ÁÒ·´¶ÔÓÃstringÆ´½Óxml¡£Êý¾Ý¿â¿ÉÒÔ´æ·ÅxmlÀàÐÍÊý¾Ý£¬ÄÇô¸ÃÊý¾ÝµÄ¾ßÌå²Ù×÷ÓÖÈçºÎÁË¡£
1.Ê×ÏȽ¨Á¢Ò»Õź¬ÓÐxmlÊý¾ÝÀàÐ͵ıí
CREATE TABLE [dbo].[TestXml](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[Message] [xml] NULL ......
1. GROUP BY ÊÇ·Ö×é²éѯ, Ò»°ã GROUP BY ÊǺ;ۺϺ¯ÊýÅäºÏʹÓÃ
group by ÓÐÒ»¸öÔÔò,¾ÍÊÇ select ºóÃæµÄËùÓÐÁÐÖÐ,ûÓÐʹÓþۺϺ¯ÊýµÄÁÐ,±ØÐë³öÏÖÔÚ group by ºóÃ棨ÖØÒª£©
ÀýÈç,ÓÐÈçÏÂÊý¾Ý¿â±í£º
A B
1 abc
1 bcd
1 asdfg
Èç¹ûÓÐÈ ......
oracleµÄodbcÍø¹Ø£¨gateway£©¼¸ºõÌṩһ¸öÎÞÏßµÄÊý¾ÝÕûºÏƽ̨£¬ÔÚoracleºÍÆäËüRDBMSÖ®¼ä£¬ÎÒÔÚÕâ²»Ïë˵ËüµÄ£¬²Ù×÷£¬ÏÞÖÆÒÔ¼°Ïà¹ØÐÔ£¬Ëü½â¾öÁËÒ»¸öСÎÊÌ⣬°ÑËü½¨Á¢ÆðÀ´ÄãÄÜ£¬ÀýÈ磬´´½¨Ò»¸ö database link ÔÚoracle ºÍoracleÖ®¼ä£¬±Ï¾¹£¬ÕâÑù²»ÊǺܺÃô£¬ÀýÈçÄãÄÜÔËÐÐÏÂÃæµÄsqlÓï¾ä£¬
select o.col1, m.col1 from or ......