ÈçºÎÓ¦¶Ô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ÖÐobject_idº¯ÊýµÄÓ÷¨ ÊÕ²Ø
int object_id('objectname');
´Ë·½·¨·µ»ØÊý¾Ý¿â¶ÔÏó±êʶºÅ¡£
ÆäÖУ¬²ÎÊýobjectname ±íʾҪʹÓõĶÔÏó£¬ÆäÊý¾ÝÀàÐÍΪnchar»òchar£¨Èç¹ûΪchar£¬ÏµÍ³½«Æäת»»Îªnchar£©
·µ»ØÀàÐÍΪint£¬±íʾ¸Ã¶ÔÏóÔÚϵͳÖеıàºÅ¡£
±ÈÈ磺
use wf_timesheet
select object_id('usp_check_excess ......
¡¡Microsoft SQL server2000ÓÉһϵÁÐÏ໥Ð×÷µÄ×é¼þ¹¹³É¡£ÄÜÂú×ã×î´óµÄWEBÕ¾µãºÍÆóÒµÊý¾Ý´¦Àíϵͳ´æ´¢ºÍ·ÖÎöÊý¾ÝµÄÐèÒª¡£±¾ÎÄ´øÀ´µÄ¾ÍÊÇÔÚwindows»·¾³ÏÂSQL2000µÄ°²×°¹ý³Ì¡£
¡¡¡¡
¡¡¡¡ÏµÍ³ÐèÇó
¡¡¡¡
¡¡¡¡ÕâÀïÒÔÆäËĺÏÒ»°æ±¾ÎªÀý£¬ÒÔÏ°²×°¹ý³ÌͬÀí¡£Microsoft SQL Server 2000 ¿ÉÔÚÔËÐÐ Intel»ò¼æÈÝµÄ Pentium¡¢Pentium ......
Ôړн¨”²Ëµ¥ÖУ¬ÓÐProgram window£¬Test window£¬SQL windowºÍCommand windowµÈ¡£
SQL windowºÍCommand windowÓÐʲôÇø±ð£¿£¿
Command windowʵÏÖÁËSQL*PlusµÄËùÓй¦ÄÜ£¬ÔÊÐíÔËÐÐsql*plusÃüÁsqlÃüÁsql½Å±¾¡£
SQL windowÓÃÓÚÖ´ÐÐsqlÓï¾ä£¬ÏÔʾsqlÊä³ö£¬Ö´ÐÐͳ¼ÆÐÅÏ¢¡££¨²âÊÔsqlÓï¾ä£¬²é¿´±íÖеÄÊý¾Ý£¬ ......
Ò»´ÎProjectÏîĿƽ̨(PWA)ÒâÍâÍ£»úÇÒÅäÖÃÊý¾Ý¿âSharePoint_Config µÄLDF±»ÒâÍâɾ³ý,Èç¹ûÖ±½Ó¸½¼ÓMDFÎļþÔòÎÞ·¨¸½¼Ó.
Ïȳ¢ÊÔsp_attach_single_file_db»Ö¸´,Ö´ÐÐÈçÏÂ:
sp_attach_single_file_db 'SharePoint_Config','D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SharePoint_Config.mdf'
³öÏÖ´íÎóÌáʾ:
......