asp.netÖг£ÓõÄ26¸öÓÅ»¯ÐÔÄܵķ½·¨
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯¡¡
¡¡
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕʱÊÕ»ØÁ¬½Ó£¬µÈ´ýÏÂÒ»´ÎµÄÁ¬½ÓÇëÇó¡£Á¬½Ó³ØµÄ´óСÊÇÓÐÏ޵ģ¬Èç¹ûÔÚÁ¬½Ó³Ø´ïµ½×î´óÏ޶ȺóÈÔÒªÇó´´½¨Á¬½Ó£¬±ØÈ»´ó´óÓ°ÏìÐÔÄÜ¡£Òò´Ë£¬ÔÚ½¨Á¢Êý¾Ý¿âÁ¬½ÓºóÖ»ÓÐÔÚÕæÕýÐèÒª²Ù×÷ʱ²Å´ò¿ªÁ¬½Ó£¬Ê¹ÓÃÍê±ÏºóÂíÉϹرգ¬´Ó¶ø¾¡Á¿¼õÉÙÊý¾Ý¿âÁ¬½Ó´ò¿ªµÄʱ¼ä£¬±ÜÃâ³öÏÖ³¬³öÁ¬½ÓÏÞÖƵÄÇé¿ö¡£ ¡¡¡¡
ʹÓô洢¹ý³Ì ¡¡
¡¡
´æ´¢¹ý³ÌÊÇ´æ´¢ÔÚ·þÎñÆ÷ÉϵÄÒ»×éÔ¤±àÒëµÄSQLÓï¾ä£¬ÀàËÆÓÚDOSϵͳÖеÄÅú´¦ÀíÎļþ¡£´æ´¢¹ý³Ì¾ßÓжÔÊý¾Ý¿âÁ¢¼´·ÃÎʵŦÄÜ£¬ÐÅÏ¢´¦Àí¼«ÎªÑ¸ËÙ¡£Ê¹Óô洢¹ý³Ì¿ÉÒÔ±ÜÃâ¶ÔÃüÁîµÄ¶à´Î±àÒ룬ÔÚÖ´ÐÐÒ»´ÎºóÆäÖ´Ðй滮¾ÍפÁôÔÚ¸ßËÙ»º´æÖУ¬ÒÔºóÐèҪʱֻÐèÖ±½Óµ÷Óûº´æÖеĶþ½øÖÆ´úÂë¼´¿É¡£ÁíÍ⣬´æ´¢¹ý³ÌÔÚ·þÎñÆ÷¶ËÔËÐУ¬¶ÀÁ¢ÓÚASP.NET³ÌÐò£¬±ãÓÚÐ޸ģ¬×îÖØÒªµÄÊÇËü¿ÉÒÔ¼õÉÙÊý¾Ý¿â²Ù×÷Óï¾äÔÚÍøÂçÖеĴ«Êä¡£
ÓÅ»¯²éѯÓï¾ä
¡¡¡¡
ASP.NETÖÐADOÁ¬½ÓÏûºÄµÄ×ÊÔ´Ï൱´ó£¬SQLÓï¾äÔËÐеÄʱ¼äÔ½³¤£¬Õ¼ÓÃϵͳ×ÊÔ´µÄʱ¼äÒ²Ô½³¤¡£Òò´Ë£¬¾¡Á¿Ê¹ÓÃÓÅ»¯¹ýµÄSQLÓï¾äÒÔ¼õÉÙÖ´ÐÐʱ¼ä¡£±ÈÈ磬²»ÔÚ²éѯÓï¾äÖаüº¬×Ó²éѯÓï¾ä£¬³ä·ÖÀûÓÃË÷ÒýµÈ¡£ ¡¡¡¡
2. ×Ö·û´®²Ù×÷ÐÔÄÜÓÅ»¯¡¡
¡¡
ʹÓÃÖµÀàÐ͵ÄToString·½·¨
¡¡¡¡
ÔÚÁ¬½Ó×Ö·û´®Ê±£¬¾³£Ê¹ÓÃ"+"ºÅÖ±½Ó½«Êý×ÖÌí¼Óµ½×Ö·û´®ÖС£ÕâÖÖ·½·¨ËäÈ»¼òµ¥£¬Ò²¿ÉÒԵõ½ÕýÈ·½á¹û£¬µ«ÊÇÓÉÓÚÉæ¼°µ½²»Í¬µÄÊý¾ÝÀàÐÍ£¬Êý×ÖÐèҪͨ¹ý×°Ïä²Ù×÷ת»¯ÎªÒýÓÃÀàÐͲſÉÒÔÌí¼Óµ½×Ö·û´®ÖС£µ«ÊÇ×°Ïä²Ù×÷¶ÔÐÔÄÜÓ°Ïì½Ï´ó£¬ÒòΪÔÚ½øÐÐÕâÀà´¦Àíʱ£¬½«ÔÚÍйܶÑÖзÖÅäÒ»¸öеĶÔÏó£¬ÔÓеÄÖµ¸´ÖƵ½Ð´´½¨µÄ¶ÔÏóÖС£Ê¹ÓÃÖµÀàÐ͵ÄToString·½·¨¿ÉÒÔ±ÜÃâ×°Ïä²Ù×÷£¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòÐÔÄÜ¡£ ¡¡¡¡
ÔËÓÃStringBuilderÀà ¡¡¡¡
StringÀà¶ÔÏóÊDz»¿É¸Ä±äµÄ£¬¶ÔÓÚString¶ÔÏóµÄÖØи³ÖµÔÚ±¾ÖÊÉÏÊÇÖØд´½¨ÁËÒ»¸öString¶ÔÏó²¢½«ÐÂÖµ¸³Óè¸Ã¶ÔÏó£¬Æä·½·¨ToString¶ÔÐÔÄܵÄÌá¸ß²¢·ÇºÜÏÔÖø¡£ÔÚ´¦Àí×Ö·û´®Ê±£¬×îºÃʹÓÃStringBuilderÀ࣬Æä.NET ÃüÃû¿Õ¼äÊÇSystem.Text¡£¸ÃÀಢ·Ç´´½¨ÐµĶÔÏ󣬶øÊÇͨ¹ýAppend£¬Remove£¬InsertµÈ·½·¨Ö±½Ó¶Ô×Ö·û´®½øÐвÙ×÷£¬Í¨¹ýToString·½·¨·µ»Ø²Ù×÷½á¹û¡£ ¡¡¡¡Æ䶨Òå¼°²Ù×÷Óï¾äÈçÏÂËùʾ£º
int num; ¡¡¡¡System.Text.StringBuilder str =
Ïà¹ØÎĵµ£º
public static bool AddTbmember(Tbmember member, string regip)
{
bool check = false;
try
{
SqlCommand sqlcommnad = new SqlCommand("Pro_AddUsers", sqlconn.GetConn());
sqlcommnad.CommandType = CommandType.StoredProcedure; ......
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn;
SqlCommand cmd1, cmd2;
SqlTransaction tra;
conn = new SqlConnection("server=.;database=test;uid=sa;pwd=123");
conn.Open();
tra = conn.BeginTransaction();//¿ªÊ¼ÊÂÎ ......
×îÖÕЧ¹ûÈçÏÂͼ£º
-----------------------------------------------------------------------------------------------
Ñùʽ²¿·Ö£º
<style type="text/css">
.anpager .cpb
{
& ......
1.´úÂëºóÖÃ
´úÂëºóÖÃÊÇ΢ÈíµÄÒ»Ïî¼¼Êõ£¬Ò²ÊÇÎÒÃDZàдASP.NET³£ÓõıàÂ뷽ʽ¡£¾ßÌ巽ʽ¾ÍÏñÒ³ÃæÎļþ(.aspx)ºÍ´úÂëÎļþ(.cs)Á½¸öÎļþÏ໥¹ØÁª
Ëù¹¹³ÉµÄÒ³Ãæ¡£Ò»±ßÇé¿öÏ£¬.aspxÎļþÖÐûÓдúÂë¡¢Ö»ÓпռäºÍHTML´úÂ룬¶ø.csÎļþÖбàдÏà¹ØµÄ´úÂë²Ù×÷¡£
ÕâÑù×öµÄºÃ´¦¾ÍÊÇ£ºÊ¹´úÂëÓëÒ³ ......