/// <summary> /// 增加一条数据 /// </summary> public int Add(KFB_LMGL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into KFB_LMGL("); strSql.Append("N_NO,N_LMMC,N_LX,N_XH,N_LEVEL,N_LMMC_EN,N_LMMC_CN,N_LMMC_TW,N_LMMC_TH)"); strSql.Append(" values ("); strSql.Append(" EXAMPLE_SEQ.nextval,:N_LMMC,:N_LX,:N_XH,:N_LEVEL,:N_LMMC_EN,:N_LMMC_CN,:N_LMMC_TW,:N_LMMC_TH)"); OracleParameter[] parameters = { new OracleParameter(":N_LMMC", OracleType.VarChar, 100), new OracleParameter(":N_LX", OracleType.Number, 4), new OracleParameter(":N_XH", OracleType.Number, 4), new OracleParameter(":N_LEVEL", OracleType.Number, 4), new OracleParameter(":N_LMMC_EN", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_CN", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_TW", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_TH", OracleType.NVarChar, 100) }; parameters[0].Value = model.N_LMMC; parameters[1].Value = model.N_LX; parameters[2].Value = model.N_XH; parameters[3].Value = model.N_LEVEL; parameters[4].Value = model.N_LMMC_EN; parameters[5].Value = model.N_LMMC_CN; parameters[6].Value = model.N_LMMC_TW; parameters[7].Value = model.N_LMMC_TH; return(DbHelperOra.ExecuteSql(strSql.ToString(), parameters)); }
protected void grvUnion_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { //TextBox grvtxtName = (TextBox)e.Row.FindControl("grvtxtName"); //TextBox grvtxtName_EN = (TextBox)e.Row.FindControl("grvtxtName_EN"); //TextBox grvltxtName_CN = (TextBox)e.Row.FindControl("grvltxtName_CN"); //TextBox grvltxtName_TW = (TextBox)e.Row.FindControl("grvltxtName_TW"); // TextBox grvltxtName_TH = (TextBox)e.Row.FindControl("grvltxtName_TH"); // TextBox grvltxtNO = (TextBox)e.Row.FindControl("grvltxtNO"); //DropDownList grvdrpLevel = (DropDownList)e.Row.FindControl("grvdrpLevel"); // Label grvllblLevel = (Label)e.Row.FindControl("grvllblLevel"); string grvhidNO = ((HiddenField)this.grvUnion.Rows[e.RowIndex].FindControl("grvhidNO")).Value.Trim(); string grvtxtName = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvtxtName")).Text.Trim(); string grvtxtName_EN = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvtxtName_EN")).Text.Trim(); string grvltxtName_CN = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvltxtName_CN")).Text.Trim(); string grvltxtName_TW = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvltxtName_TW")).Text.Trim(); string grvltxtName_TH = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvltxtName_TH")).Text.Trim(); string grvltxtNO = ((TextBox)this.grvUnion.Rows[e.RowIndex].FindControl("grvltxtNO")).Text.Trim(); string grvdrpLevel = ((DropDownList)this.grvUnion.Rows[e.RowIndex].FindControl("grvdrpLevel")).SelectedValue.Trim(); KFB_LMGL o_KFB_LMGL = new KFB_LMGL(); o_KFB_LMGL.N_NO = Convert.ToInt32(grvhidNO); o_KFB_LMGL.N_LMMC = grvtxtName; o_KFB_LMGL.N_LMMC_EN = grvtxtName_EN; o_KFB_LMGL.N_LMMC_CN = grvltxtName_CN; o_KFB_LMGL.N_LMMC_TW = grvltxtName_TW; o_KFB_LMGL.N_LMMC_TH = grvltxtName_TH; o_KFB_LMGL.N_LX = mi_TYPE;//棒球/冰球 o_KFB_LMGL.N_XH = Convert.ToInt32(grvltxtNO); o_KFB_LMGL.N_LEVEL = Convert.ToInt32(this.drpLevel.SelectedValue); int i = objUnionDB.Update(o_KFB_LMGL);; if (i > 0) { grvUnion.EditIndex = -1; Query(); this.ShowMsg("修改成功"); } else { this.ShowMsg("修改失败"); } } catch (Exception ex) { this.WriteLog(ex.ToString()); this.ShowMsg("修改失败"); } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(KFB_LMGL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update KFB_LMGL set "); strSql.Append("N_LMMC=:N_LMMC,"); strSql.Append("N_LX=:N_LX,"); strSql.Append("N_XH=:N_XH,"); strSql.Append("N_LEVEL=:N_LEVEL,"); strSql.Append("N_LMMC_EN=:N_LMMC_EN,"); strSql.Append("N_LMMC_CN=:N_LMMC_CN,"); strSql.Append("N_LMMC_TW=:N_LMMC_TW,"); strSql.Append("N_LMMC_TH=:N_LMMC_TH"); strSql.Append(" where N_NO=:N_NO "); OracleParameter[] parameters = { new OracleParameter(":N_NO", OracleType.Number, 4), new OracleParameter(":N_LMMC", OracleType.VarChar, 100), new OracleParameter(":N_LX", OracleType.Number, 4), new OracleParameter(":N_XH", OracleType.Number, 4), new OracleParameter(":N_LEVEL", OracleType.Number, 4), new OracleParameter(":N_LMMC_EN", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_CN", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_TW", OracleType.NVarChar, 100), new OracleParameter(":N_LMMC_TH", OracleType.NVarChar, 100) }; parameters[0].Value = model.N_NO; parameters[1].Value = model.N_LMMC; parameters[2].Value = model.N_LX; parameters[3].Value = model.N_XH; parameters[4].Value = model.N_LEVEL; parameters[5].Value = model.N_LMMC_EN; parameters[6].Value = model.N_LMMC_CN; parameters[7].Value = model.N_LMMC_TW; parameters[8].Value = model.N_LMMC_TH; return(DbHelperOra.ExecuteSql(strSql.ToString(), parameters)); }
protected void btnAdd_Click(object sender, EventArgs e) { try { KFB_LMGL o_KFB_LMGL = new KFB_LMGL(); o_KFB_LMGL.N_LMMC = this.txtName.Text; o_KFB_LMGL.N_LMMC_EN = this.txtName_EN.Text; o_KFB_LMGL.N_LMMC_CN = this.txtName_CN.Text; o_KFB_LMGL.N_LMMC_TW = this.txtName_TW.Text; o_KFB_LMGL.N_LMMC_TH = this.txtName_TH.Text; o_KFB_LMGL.N_LX = mi_TYPE;//棒球/冰球 o_KFB_LMGL.N_XH = Convert.ToInt32(this.txtNo.Text); o_KFB_LMGL.N_LEVEL = Convert.ToInt32(this.drpLevel.SelectedValue); int i = objUnionDB.Add(o_KFB_LMGL); if (i > 0) { this.txtNo.Text = ""; this.txtName.Text = ""; this.txtName_EN.Text = ""; this.txtName_CN.Text = ""; this.txtName_TW.Text = ""; this.txtName_TH.Text = ""; this.btnAdd.Text = "新增聯盟"; Query(); this.ShowMsg("新增成功"); } else { this.ShowMsg("新增失败"); } } catch (Exception ex) { this.WriteLog(ex.ToString()); this.ShowMsg("新增失败"); } }