aspire.net samples

satya - Thursday, May 24, 2007 11:00:37 PM

calling an update query


Hashtable parms = new Hashtable();
        //@query_name,@query_desc,@query_body,@user_id
        parms.Add("@query_name",inQueryName);
        parms.Add("@query_desc",inQuerydesc);
        parms.Add("@query_body",inQueryText);
        parms.Add("@user_id","satya");
        AppServices.getObject("/request/CreateQuery"
            , parms);

satya - Thursday, May 24, 2007 11:02:18 PM

Defining the statement in web.config


<request name="CreateQuery" 
         type="com.ai.db.generic.GenCommandExecutorForDataSet,Aspire.Net" 
         query_type="update" 
        params="@query_name,@query_desc,@query_body,@user_id">
      <commandstring>
        insert into swn_query (query_name,query_desc,query_body,user_id)
        values (:query_name, :query_desc, :query_body,:user_id)
      </commandstring>
</request>

satya - Wednesday, May 30, 2007 10:42:12 AM

Getting a custom object


<request name="getQueryForId" 
             type="com.ai.db.generic.GenStoredProcExecutor,Aspire.Net" 
            params="">
      <commandstring>
        select * from swn_query where query_id=:query_id
      </commandstring>

      <factory type="com.ai.db.ReflectionDOFactory,Aspire.Net">
        <objecttype>ASP.QueryDO,App_Code</objecttype>
      </factory>

    </request>

satya - Wednesday, May 30, 2007 2:47:53 PM

That didnt work

That didnt work

satya - Wednesday, May 30, 2007 2:48:33 PM

what worked


<request name="getQueryForId" 
             type="com.ai.db.generic.GenStoredProcExecutor,Aspire.Net" 
            params="@query_id">
      <commandstring>
        select * from swn_query where query_id=:query_id
      </commandstring>
      <factory type="com.ai.db.ReflectionDOFactory,Aspire.Net">
        <objecttype>QueryDO,App_Code</objecttype>
      </factory>
    </request>

satya - Wednesday, May 30, 2007 2:48:55 PM

Notice the lack of ASP. in the name space for the classname

Notice the lack of ASP. in the name space for the classname

satya - Wednesday, May 30, 2007 2:49:34 PM

The definition for the querydo


public class QueryDO
{
    public QueryDO(){}
    public String query_name="";
    public Decimal query_id=0;
    public String query_desc="";
    public String query_body="";
}//eof-class

satya - Wednesday, May 30, 2007 2:50:42 PM

Source code for retrieving this object


private QueryDO getQueryForId(int queryId)
    {
        Hashtable ht = new Hashtable();
        ht.Add("@query_id", queryId);
        ICollection rowCollection =
            (ICollection)AppServices
                  .getObject("/request/getQueryForId", ht);
        if (rowCollection.Count == 0)
        {
            throw new Exception("No rows found");
        }
        IEnumerator enu = rowCollection.GetEnumerator();
        enu.MoveNext();
        return (QueryDO)enu.Current;
    }

satya - Wednesday, June 06, 2007 9:19:24 AM

Passing the commandstring directly


private DataSet getAspireDatasetPostback()
    {
        string selectStatement =
            this.cq.getCompleteQuery();


        Hashtable parms = new Hashtable();
        parms.Add("commandstring", selectStatement);
        DataSet rtnDs = (DataSet)AppServices.getObject("/request/getbasicwells1"
            , parms);
        //rtnDs.WriteXml(Console.Out, XmlWriteMode.IgnoreSchema);
        return rtnDs;

    }