Example #1
0
    protected void btn_upload_Click(object sender, EventArgs e)
    {
        str_sql = "SELECT sqr,xmbh,zqbg_dName,zqbg from t_teacher_list where appNo = '" + Session["appNo"].ToString() + "';";
        DataRow dr = DBFun.GetDataRow(str_sql);

        if (dr == null)
        {
            return;
        }

        string str_sqr      = dr["sqr"].ToString();
        string str_xmbh     = dr["xmbh"].ToString();
        string str_FileName = "教研课题(任务书)_" + str_sqr + "_" + str_xmbh;
        string str_pra      = CommFun.UploadFile(fu_1, "任务书", str_FileName);

        if (str_pra == "" || str_pra == ",")
        {
            return;
        }
        else if (str_pra.Substring(0, 5) == "不允许上传")
        {
            Response.Write("<script>alert('" + str_pra + "!');</script>");
            return;
        }
        str_sql = string.Format("update t_teacher_list set rws = '{0}',rws_dName = '{1}' where appNo = '{2}'",
                                str_pra.Substring(str_pra.IndexOf(",") + 1), str_pra.Substring(0, str_pra.IndexOf(",")), Session["appNo"].ToString());
        try
        {
            if (DBFun.ExecuteUpdate(str_sql))
            {
                Response.Write("<script>alert('保存成功!');</script>");
                bindData();
            }
            else
            {
                Response.Write("<script>alert('保存失败!');</script>");
            }
        }
        catch (Exception ee)
        {
            Response.Write("<script>alert('" + ee.Message.Replace("'", "|") + "');</script>");
        }
    }