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

asp.net C#ÃüÃû²ÎÊýSqlParameterÏê½â

DBHelper:
         /// <summary>
        /// Ö´Ðвéѯ
        /// </summary>
        /// <param name="sql">ÓÐЧµÄselectÓï¾ä</param>
        /// <returns>·µ»ØSqlDataReader</returns>
        public static SqlDataReader ExecuteReader(string sql)
        {
            SqlConnection con = new SqlConnection(constring);
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            return cmd.ExecuteReader(CommandBehavior.CloseConnection);
        }
        /// <summary>
        /// Ö´Ðвéѯ´ø²ÎÊý
        /// </summary>
        /// <param name="sql">ÓÐЧµÄselectÓï¾ä</param>
        /// <returns>·µ»ØSqlDataReader</returns>
        public static SqlDataReader ExecuteReader(string sql,SqlParameter parameter)
        {
            SqlConnection con = new SqlConnection(constring);
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.Parameters.Add(parameter);
&nbs


Ïà¹ØÎĵµ£º

´ø±à¼­µÄÏÂÀ­¿òasp.net

ÐÞ¸ÄÁË´Ó£ºhttp://www.cnblogs.com/ejiyuan/archive/2007/11/09/954325.htmlµÄÒ»ÅúÎÄÕ Éú³ÉÁË¿ÉÒÔÔÚGridviewÀïÃæµ÷ÓõÄCombBox¿Ø¼þ£¬ÊÇ»ùÓÚAjaxµÄ¡£
    ¶ÀÁ¢Ê¹ÓÃʹÓ÷½Ê½£¨£©£º  <Com:ComboBox ID="ComboBox2" runat="server" Independent="true"  Width="80px" EnableViewState="true"> ......

40ÌõASP.NET¿ª·¢Tip

1¡¢ÔÚcompilation Ï£¬ÇëÉèÖÃdebug=false £¬ÈçÏ£º
default Language="c#" debug="false">
2¡¢ÇëʹÓÃServer.Transfer´úÌæResponse.Redirect¡£
3¡¢Ê¹ÓÃValidator¿Ø¼þ£¬ÇëÒª¾­³£¼ì²éPage.IsValid¡£
4¡¢ÇëʹÓÃforeachÑ­»·£¬¶ø²»ÊÇΪ×Ö·û´®µü´úÑ­»·¡£
5¡¢ÇëʹÓÿͻ§¶ËÑéÖ¤·½Ê½(²»ÒªÃ¿´Î¶¼ÔÚ·þÎñ¶ËÑéÖ¤)¡£
6¡ ......

40ÌõASP.NET¿ª·¢Tip

»¶Ó­ÅÄש£¬¹²Í¬½ø²½£¡£¡£¡
1¡¢ÔÚcompilation Ï£¬ÇëÉèÖÃdebug=false £¬ÈçÏ£º
 
default Language="c#" debug="false">
2¡¢ÇëʹÓÃServer.Transfer´úÌæResponse.Redirect¡£
3¡¢Ê¹ÓÃValidator¿Ø¼þ£¬ÇëÒª¾­³£¼ì²éPage.IsValid¡£
4¡¢ÇëʹÓÃforeachÑ­»·£¬¶ø²»ÊÇΪ×Ö·û´®µü´úÑ­»·¡£
5¡¢ÇëʹÓÿͻ§¶ËÑéÖ¤ ......

ASP.NET³ÌÐòÖг£ÓôúÂë»ã×Ü

 1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º //´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"’)£¼/script£¾")
¡¡¡¡//½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");

2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ