views:

65

answers:

1

hi i am using subsonic 3 and activerecord it is my first time with this and i was just wondering if anyone can point me to some reading material with regards to inserting records.

the examples i can find for adding and editing only seem to add and update the data, but i want to check the data first and replace any single quotes with doubles etc etc

or even encode the data first, before it is added or updated, so if anyone can point me in the right direction of some real examples that would be much appreciated

thanks

dave

+2  A: 

the column are represented as normal properties in active record objects. the values for columns are passed using these properties. if you want to do any modifications before before pushing values to database you only need to modify these properties and then call save method on the object. like:

var arObj=new MyOrder();
arObj.OrderId = 15;
arObj.OrderDate = DateTime.Now;
arObj.Description = "..................";

suppose you want to modify Description property of MyOrder object before saving to database:

arObj.Description = Abracadabra(arObj.Description);

arObj.Save();
TheVillageIdiot
excellent, thanx very much
minus4