日期:2014-05-17  浏览次数:20851 次

谁能帮我看下这个错误,谢谢


      protected void btn_Ok_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                CheckBox cka = (CheckBox)GridView1.Rows[i].FindControl("chkid");
                if (cka.Checked)
                {

                    int id = Convert.ToInt32(GridView1.DataKeys[i].Value.ToString());

                    string  strsql = "delete from orders where id='" + id + "'";

                    string strsql123 = "select pdfPath from orders where id ='" +id+ "'";
                      DataRow drw = DBFun.GetDataRow(strsql123);
                    
                       string filename = drw["pdfPath"].ToString();

                       string path = Server.MapPath("..//uploadpic//" + filename);
                       System.IO.File.Delete(path);
                           if (DBFun.ExecuteUpdate(strsql))
                           {
                               ltl_Msg.Text = "删除成功!";
                               DataView dvlist = DBFun.GetDataView("select * From orders order by id desc");
                               AspNetPager1.RecordCount = dvlist.Table.Rows.Count;
                               Session["dvlist"] = dvlist;