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