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

ASP.NET


      ͨ³££¬SQL Óï¾äºÍ´æ´¢¹ý³Ì°üÀ¨ÔËÐÐʱ¼ÆËãµÄ²ÎÊý¡£Ê¹ÓòÎÊý±àдµÄ SQL Óï¾ä³Æ×÷²ÎÊý»¯ SQL Óï¾ä¡£
ʹÓà SqlDataSource ¿Ø¼þʱ£¬¿ÉÒÔÖ¸¶¨Ê¹ÓòÎÊýµÄ SQL ²éѯºÍÓï¾ä¡£Í¨¹ý¸ù¾ÝÔËÐÐʱ¼ÆËãµÄÖµ¶ÁдÊý¾Ý¿âÐÅÏ¢£¬ÕâÓÐÖúÓÚÌáÉýÊý¾Ý°ó¶¨»·¾³µÄÁé»îÐÔ¡£¿ÉÒÔ´Ó¸÷ÖÖÔ´»ñÈ¡²ÎÊýÖµ¡£ÕâЩԴ°üÀ¨ ASP.NET Ó¦ÓóÌÐò±äÁ¿¡¢Óû§±êʶºÍÓû§Ñ¡ÔñµÄÖµ¡£¿ÉÒÔʹÓòÎÊýÖ´ÐÐÏÂÁвÙ×÷£ºÌṩÓÃÓÚÊý¾Ý¼ìË÷µÄËÑË÷Ìõ¼þ£»ÌṩҪÔÚÊý¾Ý´æ´¢ÇøÖвåÈë¡¢¸üлòɾ³ýµÄÖµ£»ÌṩÓÃÓÚÅÅÐò¡¢·ÖÒ³ºÍɸѡµÄÖµ¡£
 
Ò»¡¢Ê¹ÓòÎÊý
ͬËùÓеÄÊý¾ÝÔ´¿Ø¼þÒ»Ñù£¬SqlDataSource ¿Ø¼þÔÚÔËÐÐʱ½ÓÊÜÊäÈë²ÎÊý£¬²¢ÔÚ²ÎÊý¼¯ºÏÖжԲÎÊý½øÐйÜÀí¡£Ã¿Ò»ÏîÊý¾Ý²Ù×÷¶¼ÓÐÒ»¸öÏà¹ØµÄ²ÎÊý¼¯ºÏ¡£¶ÔÓÚÑ¡Ôñ²Ù×÷£¬¿ÉÒÔʹÓà SelectParameters ¼¯ºÏ£»¶ÔÓÚ¸üвÙ×÷£¬¿ÉÒÔʹÓà UpdateParameters ¼¯ºÏ£¬ÒÀ´ËÀàÍÆ¡£
¿ÉÒÔΪÿ¸ö²ÎÊýÖ¸¶¨Ãû³Æ¡¢ÀàÐÍ¡¢·½ÏòºÍĬÈÏÖµ¡£¶ÔÓÚ´ÓÌض¨¶ÔÏó£¨ÀýÈ磬¿Ø¼þ¡¢»á»°±äÁ¿»òÓû§ÅäÖÃÎļþ£©»ñÈ¡ÖµµÄ²ÎÊý£¬ÐèÒªÉèÖÃÆäËûÊôÐÔ¡£ÀýÈ磬ControlParameter ÒªÇóÉèÖà ControlID ÒÔ±êʶҪ´ÓÖлñÈ¡²ÎÊýÖµµÄ¿Ø¼þ£¬ÒÔ¼°ÉèÖà PropertyName ÊôÐÔÒÔÖ¸¶¨°üº¬²ÎÊýÖµµÄÊôÐÔ¡£
ÁíÍ⣬SqlDataSource ¿Ø¼þ½«»ùÓÚÖ§³Ö×Ô¶¯¸üС¢²åÈëºÍɾ³ý²Ù×÷µÄÊý¾Ý°ó¶¨¿Ø¼þ£¨ÀýÈç GridView »ò FormView ¿Ø¼þ£©Ëù´«µÝµÄÖµ×Ô¶¯´´½¨²ÎÊý¡£
 
¶þ¡¢ÔÚÃüÁîÖÐÖ¸¶¨²ÎÊý
ʹÓà SqlDataSource ¿Ø¼þʱ£¬¿ÉÒÔ½«¸Ã¿Ø¼þµÄÃüÁîÊôÐÔÉèÖÃΪ²ÎÊý»¯ SQL Óï¾ä»ò´æ´¢¹ý³ÌµÄÃû³Æ¡£Èç¹ûÖ¸¶¨ÃüÁîµÄ´æ´¢¹ý³Ì£¬±ØÐ뽫¸ÃÃüÁîµÄÃüÁîÀàÐÍÖ¸¶¨Îª StoredProcedure¡£
2.1¡¢²ÎÊýÃû³Æ
‏      SqlDataSource ¿Ø¼þ¿ÉÒÔ½« ParameterPrefix ÊôÐÔµÄÖµÌí¼Óµ½ËùÓвÎÊýÃû³ÆµÄ¿ªÍ·¡£‎£¨Ä¬ÈϵÄǰ׺Ϊ“@”¡££©
Èç¹û GridView ¿Ø¼þµÈÊý¾Ý°ó¶¨¿Ø¼þ°ó¶¨µ½ SqlDataSource ¿Ø¼þ£¬ÔÚÖ´Ðиüлòɾ³ý²Ù×÷Æڼ䣬¸ÃÊý¾Ý°ó¶¨¿Ø¼þ»áͬʱ½«µ±Ç°¼Ç¼ֵºÍԭʼ¼Ç¼ֵ´«µÝµ½ SqlDataSource ¿Ø¼þ¡£µ±Ç°Öµ´«µÝµ½ Values ×ÖµäÖС£Ô­Ê¼Öµ´«µÝµ½ Keys »ò OldValues ×ÖµäÖС£¶ÔÓÚ¸ø¶¨µÄÊý¾Ý²Ù×÷£¬ÕâЩ×ÖµäµÄÄÚÈݽ«»á×·¼Óµ½»ù´¡ DbCommand ¶ÔÏóµÄ Parameters ¼¯ºÏÖС£
ÔÚ SqlDataSource ¿Ø¼þµÄ SQL ÃüÁîÖУ¬Ê¹ÓÃÃüÃûÔ¼¶¨Ê¹²ÎÊýռλ·ûÓë´«µÝµ½¸ÃÃüÁîµÄÔ­À´µÄÖµÏàÆ¥Å䡣ͨ¹ýÉèÖà SqlDataSource ¿Ø¼þµÄ OldValuesParameterFormatString ÊôÐÔ£¬¿ÉÒÔ½¨Á¢¸Ãռλ·ûÃû³ÆµÄ¸ñʽ¡£½« OldValuesParameterFormatStrin


Ïà¹ØÎĵµ£º

asp.netÉÏ´«ÎļþС½á

 
£¼input id = " loFile " type = " file " runat = " server " £¾
£¼form method = " post " enctype =" multipart/form-data " runat = " server "£¾
£¼/form £¾
1.»ñµÃÉÏ´«ÎļþµÄÃû³Æ£º£¨¹Ø¼üÊÇPostedFileÀàµÄÓ¦Óã©
ʹÓÃPathÀàÖеÄGetFileName·½·¨£¬¾ßÌåÈçÏ£º
lstrFileName = loFile.PostedFile.FileName ......

ASP.NET 2.0 ±¾µØ»¯1

  ÖÚËùÖÜÖªASP.NET 2.0Àï¶Ô±¾µØ»¯£¨Localization£©×öÁ˺ܶ๤×÷£¬´ó´ó¼ò»¯ÁË¿ª·¢¹ý³Ì¡£½ñÌìÖÕÓÚÄܳé³öʱ¼äÑо¿Ò»ÏÂÕâ¸ö¼¼ÊõÁË£¬×ÊÁϺܶ࣬µ«´ó¶à´ø×ÅÒ»¹ÉÒ§ÎĽÀ×ֵķ­ÒëζµÀ£¬So......×Ô¼ºÐ´Ò»Æª¡£
1.ʹÓù¤¾ß×Ô¶¯Éú³É±¾µØ»¯×ÊÔ´£¨LocalResources£©
2.Ô­À´Localizable AttributePropertyÊÇÕâô»ØÊÂѽ
3.ÊÖ¹¤Ìí¼Ó±¾µ ......

ASP.NET×Ô¶¨Òå´íÎóÒ³Ãæ

 ASP.NET ÌṩÈýÖÖÓÃÓÚÔÚ³öÏÖ´íÎóʱ²¶»ñºÍÏìÓ¦´íÎóµÄÖ÷Òª·½·¨£ºPage_Error ʼþ¡¢Application_Error ʼþÒÔ¼°Ó¦ÓóÌÐòÅäÖÃÎļþ (Web.config)¡£
Èç¹ûÄú²»µ÷Óà Server.ClearError »òÕß²¶»ñ Page_Error »ò Application_Error ʼþÖеĴíÎó£¬Ôò½«¸ù¾Ý Web.config ÎļþµÄ <customErrors> ²¿·ÖÖеÄÉèÖô¦Àí´íÎó¡£ÔÚ & ......

asp.netÔËÐÐʱ¶¯Ì¬ÐÞ¸ÄÖ÷Ìâ

Õâ¸öÓкܶàÖÖ·½·¨ÎÒÔÚÕâÀïд¼¸¸ö°É
·½Ê½Ò»£º
ÔÚÒ³ÃæµÄPreInitʼþÖÐÖ±½ÓÉèÖ᣸÷½·¨¿ÉʵÏÖ²»Í¬Ò³Ãæ¼ÓÔز»Í¬Ö÷Ì⣬Èç¹ûҪʵÏÖÍøÕ¾ÕûÌå»»·ô£¬Ö»ÐèÒª´´½¨Ò»¸ö´ÓSystem.Web.UI.PageÀàÅÉÉúµÄ×ÓÀ࣬ÔÚ¸ÃÀàµÄPreInitʼþÖмÓÔØÌض¨Ö÷Ì⣬×îºóËùÓÐÒ³Ãæ¼Ì³Ð×Ô´ËÀ༴¿É¡£
protected override void OnPreInit(Event ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ