public bool Modify(themessData datthemess) { int iRel = -1; bool bRel = false; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); try { objDB.OpenConnection(); string strSql = "update themess set userid=@userid,messtime=@messtime,messcon=@messcon,ter=@ter,replys=@replys where Id = @Id"; objDB.Command.CommandType = System.Data.CommandType.Text; objDB.Command.CommandText = strSql; objDB.Command.Parameters.AddWithValue("@userid", datthemess.userid); objDB.Command.Parameters.AddWithValue("@messtime", datthemess.messtime); objDB.Command.Parameters.AddWithValue("@messcon", datthemess.messcon); objDB.Command.Parameters.AddWithValue("@ter", datthemess.ter); objDB.Command.Parameters.AddWithValue("@replys", datthemess.replys); objDB.Command.Parameters.AddWithValue("@Id", datthemess.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 themessData[] Select(string Id) { int iRel = -1; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); themessData[] datthemess = new themessData[1]; string sql = "select * from themess where Id= " + Id + " "; try { objDB.OpenConnection(); DataSet ds = objDB.QueryData(sql, "departmentinfo"); if (ds.Tables.Count > 0) { long nRow = ds.Tables[0].Rows.Count; if (nRow > 0) { datthemess = new themessData[nRow]; for (int i = 0; i < nRow; i++) { datthemess[i] = new themessData(); datthemess[i].userid = ds.Tables[0].Rows[i]["userid"].ToString(); datthemess[i].messtime = ds.Tables[0].Rows[i]["messtime"].ToString(); datthemess[i].messcon = ds.Tables[0].Rows[i]["messcon"].ToString(); datthemess[i].ter = ds.Tables[0].Rows[i]["ter"].ToString(); datthemess[i].replys = ds.Tables[0].Rows[i]["replys"].ToString(); } } } } catch (Exception ex) { iRel = -1; } objDB.CloseConnection(); objDB.Dispose(); objDB = null; return(datthemess); }