public bool Modify(informationsData datinformations) { int iRel = -1; bool bRel = false; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); try { objDB.OpenConnection(); string strSql = "update informations set thetit=@thetit,thetype=@thetype,thetime=@thetime,userid=@userid,memos=@memos,userclass=@userclass where Id = @Id"; objDB.Command.CommandType = System.Data.CommandType.Text; objDB.Command.CommandText = strSql; objDB.Command.Parameters.AddWithValue("@thetit", datinformations.thetit); objDB.Command.Parameters.AddWithValue("@thetype", datinformations.thetype); objDB.Command.Parameters.AddWithValue("@thetime", datinformations.thetime); objDB.Command.Parameters.AddWithValue("@userid", datinformations.userid); objDB.Command.Parameters.AddWithValue("@memos", datinformations.memos); objDB.Command.Parameters.AddWithValue("@userclass", datinformations.userclass); objDB.Command.Parameters.AddWithValue("@Id", datinformations.Id); iRel = objDB.Command.ExecuteNonQuery(); } catch (Exception ex) { iRel = -1; } objDB.CloseConnection(); objDB.Dispose(); objDB = null; bRel = (iRel.Equals(1) ? true : false); return(bRel); }
public informationsData[] Put(string casestr) { int iRel = -1; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); informationsData[] datinformations = new informationsData[1]; string sql = "select * from informations where 1 = 1 "; sql += casestr; try { objDB.OpenConnection(); DataSet ds = objDB.QueryData(sql, "departmentinfo"); if (ds.Tables.Count > 0) { long nRow = ds.Tables[0].Rows.Count; if (nRow > 0) { datinformations = new informationsData[nRow]; for (int i = 0; i < nRow; i++) { datinformations[i] = new informationsData(); datinformations[i].thetit = ds.Tables[0].Rows[i]["thetit"].ToString(); datinformations[i].thetype = ds.Tables[0].Rows[i]["thetype"].ToString(); datinformations[i].thetime = ds.Tables[0].Rows[i]["thetime"].ToString(); datinformations[i].userid = ds.Tables[0].Rows[i]["userid"].ToString(); datinformations[i].memos = ds.Tables[0].Rows[i]["memos"].ToString(); datinformations[i].userclass = ds.Tables[0].Rows[i]["userclass"].ToString(); } } } } catch (Exception ex) { iRel = -1; } objDB.CloseConnection(); objDB.Dispose(); objDB = null; return(datinformations); }