Concatenate string to query in MSD axapta with external database connection

Concatenate string to query in axapta with external database connection


 Sql1 = "select * from TestTable WHERE Column1='";  
     sql1 = sql1 + Column1 + "'";  
     sql1 = sql1 + " and convert(datetime,DateColumn1) = ' ";  
     sql1 = sql1 + date2str(DateColumn1,321,2,3,2,3,4) + "'" ;  
     sql1 = sql1 + " and status=1 order by Column1,DateColumn1";  
     command1 = new CCADOCommand();  
     command1.activeConnection(connection);  
     command1.commandText(sql1);  
     recordSet1 = new CCADORecordSet();  
     recordSet1 = command1.execute();  
     Coms1 = recordSet1.recordSet();   
    while (!recordSet1.EOF())  
     {  
       fields1 = recordSet1.fields();  
       info(strfmt("%1",fields1.itemname("Columnname").value()));  
     }