QueryDeleteRow

Description

Deletes a row from a query object.

Returns

Returns the modified query object.

Category

Syntax

QueryDeleteRow(Object queryObject, int rowNum)

History

New in ColdFusion (2018 release).

Parameters

Parameter

Required/Optional

Description

queryObject

Required

The query object in which a column is to be deleted.

rowNum

Required

The row number corresponding to the row to be deleted.

Example 1

<cfscript>
    myQuery = queryNew("id,name,amount","Integer,Varchar,Integer", 
                [ 
                        {id=1,name="One",amount=15}, 
                        {id=2,name="Two",amount=18}, 
                        {id=3,name="Three",amount=32} 
                ]); 
    writeOutput("The original query object is:")
    writeDump(myQuery)
    // Delete row
    QueryDeleteRow(myQuery,1)
    writeOutput("The modified query object is:")
    writeDump(myQuery)
</cfscript>

Output

Example 2

<cfscript>
  myResult=QueryExecute(("SELECT * FROM EMPLOYEES WHERE EMP_ID BETWEEN :low AND :high"),{low=4,high=14},
       {datasource="cfdocexamples"});
     writeOutput("Array before deleting any row" & "<br/>");
     writeDump(myResult);
     writeOutput("Deleting row 2" & "<br/>");
     myDeletedRow=QueryDeleteRow(myResult,2);
     // Display output after row deletion
     writeOutput("<br/>" & myDeletedRow);
     writeOutput("<br/>" & "Array after deleting the row" & "<br/>");
     WriteDump(myResult);
</cfscript>

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online