public bool Modify(thetitleData datthetitle) { int iRel = -1; bool bRel = false; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); try { objDB.OpenConnection(); string strSql = "update thetitle set hwid=@hwid,thetitle=@thetitle,memos=@memos where Id = @Id"; objDB.Command.CommandType = System.Data.CommandType.Text; objDB.Command.CommandText = strSql; objDB.Command.Parameters.AddWithValue("@hwid", datthetitle.hwid); objDB.Command.Parameters.AddWithValue("@thetitle", datthetitle.thetitle); objDB.Command.Parameters.AddWithValue("@memos", datthetitle.memos); objDB.Command.Parameters.AddWithValue("@Id", datthetitle.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 thetitleData[] Select(string Id) { int iRel = -1; DataAccess.CommonDB objDB = new DataAccess.CommonDB(); thetitleData[] datthetitle = new thetitleData[1]; string sql = "select * from thetitle 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) { datthetitle = new thetitleData[nRow]; for (int i = 0; i < nRow; i++) { datthetitle[i] = new thetitleData(); datthetitle[i].hwid = ds.Tables[0].Rows[i]["hwid"].ToString(); datthetitle[i].thetitle = ds.Tables[0].Rows[i]["thetitle"].ToString(); datthetitle[i].memos = ds.Tables[0].Rows[i]["memos"].ToString(); } } } } catch (Exception ex) { iRel = -1; } objDB.CloseConnection(); objDB.Dispose(); objDB = null; return(datthetitle); }