Пример #1
0
    /// <summary>
    /// 更新一条数据
    /// </summary>
    public int Update(KFB_DWGL model)
    {
        StringBuilder strSql = new StringBuilder();

        strSql.Append("update KFB_DWGL set ");
        strSql.Append("N_DWMC=:N_DWMC,N_DWMC_EN=:N_DWMC_EN,N_DWMC_CN=:N_DWMC_CN,N_DWMC_TW=:N_DWMC_TW,N_DWMC_TH=:N_DWMC_TH ");
        strSql.Append(" where  N_ID=:N_ID AND N_NO=:N_NO ");
        OracleParameter[] parameters =
        {
            new OracleParameter(":N_DWMC",    OracleType.VarChar,  100),
            new OracleParameter(":N_DWMC_EN", OracleType.NVarChar, 100),
            new OracleParameter(":N_DWMC_CN", OracleType.NVarChar, 100),
            new OracleParameter(":N_DWMC_TW", OracleType.NVarChar, 100),
            new OracleParameter(":N_DWMC_TH", OracleType.NVarChar, 100),
            new OracleParameter(":N_ID",      OracleType.Number,     4),
            new OracleParameter(":N_NO",      OracleType.Number, 4)
        };


        parameters[0].Value = model.N_DWMC;
        parameters[1].Value = model.N_DWMC_EN;
        parameters[2].Value = model.N_DWMC_CN;
        parameters[3].Value = model.N_DWMC_TW;
        parameters[4].Value = model.N_DWMC_TH;
        parameters[5].Value = model.N_ID;
        parameters[6].Value = model.N_NO;
        return(DbHelperOra.ExecuteSql(strSql.ToString(), parameters));
    }
Пример #2
0
    protected void grvTeam_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            string grvhidNO       = ((HiddenField)this.grvTeam.Rows[e.RowIndex].FindControl("grvhidNO")).Value.Trim();
            string grvhidID       = ((HiddenField)this.grvTeam.Rows[e.RowIndex].FindControl("grvhidID")).Value.Trim();
            string grvtxtName     = ((TextBox)this.grvTeam.Rows[e.RowIndex].FindControl("grvtxtName")).Text.Trim();
            string grvtxtName_EN  = ((TextBox)this.grvTeam.Rows[e.RowIndex].FindControl("grvtxtName_EN")).Text.Trim();
            string grvltxtName_CN = ((TextBox)this.grvTeam.Rows[e.RowIndex].FindControl("grvltxtName_CN")).Text.Trim();
            string grvltxtName_TW = ((TextBox)this.grvTeam.Rows[e.RowIndex].FindControl("grvltxtName_TW")).Text.Trim();
            string grvltxtName_TH = ((TextBox)this.grvTeam.Rows[e.RowIndex].FindControl("grvltxtName_TH")).Text.Trim();

            KFB_DWGL o_KFB_DWGL = new KFB_DWGL();
            o_KFB_DWGL.N_DWMC    = grvtxtName;
            o_KFB_DWGL.N_DWMC_EN = grvtxtName_EN;
            o_KFB_DWGL.N_DWMC_CN = grvltxtName_CN;
            o_KFB_DWGL.N_DWMC_TW = grvltxtName_TW;
            o_KFB_DWGL.N_DWMC_TH = grvltxtName_TH;
            o_KFB_DWGL.N_NO      = Convert.ToInt32(grvhidNO);
            o_KFB_DWGL.N_ID      = Convert.ToInt32(grvhidID);

            int i = objTeamDB.Update(o_KFB_DWGL);;
            if (i > 0)
            {
                grvTeam.EditIndex = -1;
                Query();
                this.ShowMsg("修改成功");
            }
            else
            {
                this.ShowMsg("修改失败");
            }
        }
        catch (Exception ex)
        {
            this.WriteLog(ex.ToString());
            this.ShowMsg("修改失败");
        }
    }