Axapta’dan direk SQL Insert, Update ve Delete işlemleri

Global  değişkenler

class ETGHRMKariyerSync

{

    CCADOConnection         ADOConnection;

    CCADOConnection         Connection;

 

}

 

UPDATE

public static server void HRMEducationTypeUpdate(HRMEducationType _HRMEducationType )

{

    Statement   statement;

    str         SQLCommand;

    ;

 

    // Set the SQL statement

    SQLCommand = ‘SET DATEFORMAT DMY ‘;

    SQLCommand += “UPDATE [Kariyer].[dbo].[WHRMEDUCATIONTYPE]“;

    SQLCommand += strfmt(“SET [HRMEDUCATIONTYPEID] = ‘%1′ , [DESCRIPTION] = ‘%2′ , [DATAAREAID] = ‘%3′ , [RECVERSION] = %4 WHERE [RECID] = %5″

                        ,_HRMEducationType.hrmEducationTypeId

                        ,_HRMEducationType.description

                        ,_HRMEducationType.dataAreaId

                        ,_HRMEducationType.recVersion

                        ,_HRMEducationType.RecId);

 

    //Execute Command

    ETGHRMKariyerSync::execCommand(SQLCommand);

 

}

                INSERT

public static server void HRMEducationTypeInsert(HRMEducationType _HRMEducationType )

{

    Statement   statement;

    str         SQLCommand;

    ;

 

 

    // Set the SQL statement

    SQLCommand = ‘SET DATEFORMAT DMY ‘;

    SQLCommand += ‘INSERT INTO [KariyerZaman].[dbo].[WHRMEDUCATIONTYPE] ([HRMEDUCATIONTYPEID] ,[DESCRIPTION] ,[DATAAREAID] ,[RECVERSION] ,[RECID])’;

    SQLCommand += strfmt(“VALUES ( ‘%1′ , ‘%2′ , ‘%3′ , %4 , %5)”

                        ,_HRMEducationType.hrmEducationTypeId

                        ,_HRMEducationType.description

                        ,_HRMEducationType.dataAreaId

                        ,_HRMEducationType.recVersion

                        ,_HRMEducationType.RecId);

 

 

    //Execute Command

    ETGHRMKariyerSync::execCommand(SQLCommand);

 

}

                DELETE

public static server void HRMEducationTypeDelete (HRMEducationType _HRMEducationType )

{

    Statement   statement;

    str         SQLCommand;

    ;

 

    // Set the SQL statement

    SQLCommand = “DELETE [Kariyer].[dbo].[WHRMEDUCATIONTYPE]“;

    SQLCommand += strfmt(“WHERE [RECID] = %1″

                        ,_HRMEducationType.RecId);

 

    //Execute Command

    ETGHRMKariyerSync::execCommand(SQLCommand);

 

}

 
Comment are closed.