public Boolean insertParty(enParty enParty) { try { str = "INSERT INTO party (name,status)VALUES(@name,@status);"; Dbcmd = db.GetSqlStringCommand(str); db.AddInParameter(Dbcmd, "@name", DbType.String, enParty.name); db.AddInParameter(Dbcmd, "@status", DbType.Int32, enParty.status); db.ExecuteNonQuery(Dbcmd); return true; } catch (Exception ex) { throw new Exception(ex.Message); } }
public Boolean updateParty(enParty enParty) { try { str = "UPDATE party SET name=@name, status=@status WHERE partyID=@partyID;"; Dbcmd = db.GetSqlStringCommand(str); db.AddInParameter(Dbcmd, "@name", DbType.String, enParty.name); db.AddInParameter(Dbcmd, "@status", DbType.Int32, enParty.status); db.AddInParameter(Dbcmd, "@partyID", DbType.Int32, enParty.partyID); db.ExecuteNonQuery(Dbcmd); return true; } catch (Exception ex) { throw new Exception(ex.Message); } }