Forum Discussion

mrezahoseini's avatar
mrezahoseini
Contributor
10 years ago
Solved

Execute Multiple delete query once in TestComplete 10

Hello,

I'm  new in TestComplete, I need  help

I would like to execute a bulk number of delete query, how can I do it??

My code can be seen below.

Thanks in advance.

 

 

function Delete()

{
var AConnection, Driver;

AConnection = ADO.CreateADOConnection();

AConnection.ConnectionString = "Provider=MSDAORA.1;Password=autocm931;User ID=autocm931;Data Source=srv28;Persist Security Info=True";

AConnection.LoginPrompt = false;
AConnection.Open();


AConnection.Execute_( "delete from EBUSERCHANNEL uc where uc.userid in (select id from ebuser br where br.type='BROKER' and br.name='Ascotfield');delete from ebuser br where br.type='BROKER' and br.name='Ascotfield';commit");

 


AConnection.Close();

}

  • I solved the problem like below :

     

    function Delete()

    {

    var AConnection, Driver;
    AConnection = ADO.CreateADOConnection();
    AConnection.ConnectionString = "Provider=MSDAORA.1;Password=autocm931;User ID=autocm931;Data Source=srv28;Persist Security Info=True";
    AConnection.LoginPrompt = false;
    AConnection.Open();
    var Driver = DDT.ExcelDriver("C:\\Add-User-To-Server.xls", "Sheet1");
    var name = Driver.Value(0);
    var str = "delete EBUSERCHANNEL uc where uc.userid in (select id from ebuser br where br.type = 'BROKER' and br.name like '"+name+"')";
    AConnection.Execute_(str);
    var stt = "delete from ebuser br where br.type='BROKER' and br.name='"+name+"'";
    AConnection.Execute_(stt);
    DDT.CloseDriver(Driver.Name);
    AConnection.Close();

    }

     

     

     

    Thanks ver much

     

     

     

1 Reply

  • I solved the problem like below :

     

    function Delete()

    {

    var AConnection, Driver;
    AConnection = ADO.CreateADOConnection();
    AConnection.ConnectionString = "Provider=MSDAORA.1;Password=autocm931;User ID=autocm931;Data Source=srv28;Persist Security Info=True";
    AConnection.LoginPrompt = false;
    AConnection.Open();
    var Driver = DDT.ExcelDriver("C:\\Add-User-To-Server.xls", "Sheet1");
    var name = Driver.Value(0);
    var str = "delete EBUSERCHANNEL uc where uc.userid in (select id from ebuser br where br.type = 'BROKER' and br.name like '"+name+"')";
    AConnection.Execute_(str);
    var stt = "delete from ebuser br where br.type='BROKER' and br.name='"+name+"'";
    AConnection.Execute_(stt);
    DDT.CloseDriver(Driver.Name);
    AConnection.Close();

    }

     

     

     

    Thanks ver much