Sample Code:

Insert, Update, Delete and Select are simple classes that enables you to do data access.


            using Dlib;       

            //e.g. Insert: -----------------------------------------------------------------------

            Insert objInsert = new Insert("HL_User_Insert");

             objInsert.AddParameter("@Id", SqlDbType.BigInt, 0, ParameterDirection.Output);

            objInsert.AddParameter("@Name", SqlDbType.NVarChar, "Test 3 Name");

            objInsert.AddParameter("@Active", SqlDbType.Bit, true); 

            long lngRtnVal = objInsert.Run();    

 

           //e.g. Update : -----------------------------------------------------------------------

            Update objUpdate = new Update("HL_User_Update");

            objUpdate.AddParameter("@Id", SqlDbType.BigInt, 3);

            objUpdate.AddParameter("@Name", SqlDbType.NVarChar, "Test 3+1 Name");

            objUpdate.AddParameter("@Active", SqlDbType.Bit, false);

            objUpdate.Run();      

 

            //e.g. Delete : ----------------------------------------------------------------------- 

            Delete objDelete = new Delete("HL_User_Delete");

            objDelete.AddParameter("@Id", SqlDbType.BigInt, 3); 

            objDelete.Run();

           

            //e.g. Select : ----------------------------------------------------------------------- 

            Select objSelect = new Select("HL_User_GetById");

            objSelect.AddParameter("@Id", SqlDbType.BigInt, 3); 

            objSelect.Run();

            string strName = objSelect.Read<string>("Name");

            bool blnActive = objSelect.Read<bool>("Active");

 

 


Last edited Sep 2, 2011 at 8:33 AM by eduminda, version 1

Comments

No comments yet.