public class EditCategory : IHttpHandler
{
private SQLHelper sqlhelper = new SQLHelper();
public void ProcessRequest(HttpContext context)
{
HttpResponse response = context.Response;
HttpRequest request = context.Request;
int id = Convert.ToInt32(request.Form["id"]);
string name = request.Form["name"];
string location = request.Form["location"];
string sql = "update SD_Category set CategoryName=@cname,Location=@loc where CategoryID=@cid";
OleDbParameter[] param = new OleDbParameter[]{
new OleDbParameter("@cname",name),
new OleDbParameter("@loc",location),
new OleDbParameter("@cid",id)
};
if (sqlhelper.ExecuteNonQuery(sql, param, CommandType.Text) > 0)
{
//response.ContentType = "application/json";
//response.Write("{result: '类别更新成功!'}"); //{}表示js中对象
response.Redirect("CategoryManage.aspx"); //这里跳转不了
}
}}
犯罪嫌疑人X
天涯尽头无女友
慕勒3428872
呼啦一阵风
慕后森
人到中年有点甜