Skip to main content

Insert and doindert method

Below is the Syntactical Code which is used to insert the data into table

Insert() Method program
InventoryProducts IP;
IP.Category="Candy";
IP.ProductCode="NWTCA-48";
IP.ProductName="Northwind Traders Chocolate";
IP.StandardCost=9.5625;
IP.ListPrice=12.75;
IP.QuantityPerUnit="10 pkgs";
IP.insert();

doInsert() Method program
 InventoryProducts IP;
IP.Category="Candy";
IP.ProductCode="NWTCA-48";
IP.ProductName="Northwind Traders Chocolate";
IP.StandardCost=9.5625;
IP.ListPrice=12.75;
IP.QuantityPerUnit="10 pkgs";
doinsert();

If you see the Above code it is similar in both programs except last lines insert() & doinsert() .

But the main difference is when insert() method get triggers then it calls super() method which take care's to insert the values in table.
Also , the insert() method  is used to insert values in table based on condition (true or false)

DoInsert() method ,  performs it's operation directly on the tables without-calling super() method.And here it bypass the super() method
It is desirably used only if there are no validations to take place while inserting values into tables
 


Comments

Popular posts from this blog

Initializing the table based on Parent Table using "ModifiedField" Method

Initialize or get the data from Parent Table to Child Table.And this functionality is done based on Foreign key . Below is the Lookup functionality implemented to get the data from Parent Table to Child table using Init Method Step 1 : Created Parent Table with name Product Category (ProductCategoryID , Product_Category)and entered some data in it . Step 2 : Now Created child table with Columns (Product ID, Product Name , List Price ,Standard Cost,Quantity ) And these columns are related to Products.Now Create two more Columns one Category(String) and other Category Price  (Real Datatype) . Note: In my case  I had created the child table with name "InventoryProduct" Step 3 : Get All the values of ProductCategory column  from Parent Table to child table column Category :    1. Create Relation in Child Table below is the .I had create the Relation name as "GetCategories" .And specified my parent table name in "Properties Tab -> Table" ...