/// <summary> /// 更新t_SysPara /// </summary> public virtual bool Update(SysParaOR sysPara) { string sql = "update t_SysPara set ValStr = @ValStr where KeyStr = @KeyStr"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@KeyStr", SqlDbType.NVarChar, 1000, ParameterDirection.Input, false, 0, 0, "KeyStr", DataRowVersion.Default, sysPara.Keystr), new SqlParameter("@ValStr", SqlDbType.NVarChar, 1000, ParameterDirection.Input, false, 0, 0, "ValStr", DataRowVersion.Default, sysPara.Valstr) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
/// <summary> /// 插入t_SysPara /// </summary> public virtual bool Insert(SysParaOR sysPara) { string sql = "insert into t_SysPara (KeyStr, ValStr) values (@KeyStr, @ValStr)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@KeyStr", SqlDbType.NVarChar, 1000, ParameterDirection.Input, false, 0, 0, "KeyStr", DataRowVersion.Default, sysPara.Keystr), new SqlParameter("@ValStr", SqlDbType.NVarChar, 1000, ParameterDirection.Input, false, 0, 0, "ValStr", DataRowVersion.Default, sysPara.Valstr) }; return db.ExecuteNoQuery(sql, parameters) > -1; }
public SysParaOR selectARowDate(string m_id) { string sql = string.Format("select * from t_SysPara where Keystr='{0}'", m_id); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } if (dt == null) return null; if (dt.Rows.Count == 0) return null; DataRow dr = dt.Rows[0]; SysParaOR m_SysP = new SysParaOR(dr); return m_SysP; }
protected void SmsMsgCommand_Click() { SysParaOR obj = new SysParaOR(); obj.Keystr = "defaultSmsMsg"; obj.Valstr = DefaultSmsMsg; try { new SysParaDA().Update(obj); MessageBox.Show("保存成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Question); } catch (Exception ex) { ShowMsgError(ex.Message); } }