Urgent:-Storing and excute the x++ query

Hi all,

i need to store and the x++ query(select custtable) in the database and retrieve and run the same. Any one give the code sample


This is pretty easy.

  1. Use the QueryBuild* classes to create the query;
  2. Use the pack method to convert the query to a container.
  3. Save the container in a table field of container type.
  4. Retreive the container, and create a new query passing the container as a parater.

The query will be identical to the one you created previously.


I would recommend the option of stored procedure. Calling stored proc is fairly easy. Here is a code snippet for calling a stored proc with two input parameters -

conn = new UserConnection();
stmt = conn.createStatement();
cdDate = today();
cdDateStr = date2str(cdDate,213,2,3,2,3,4);
sqlStat = strfmt("%1 %2, %3, %4", “”, curext(), “’”, cdDateStr, “’”);

Hope this helps,