On Fri, 2005-06-10 at 14:58, Rohan Sootarsing wrote:
> Yeah sorry figured alot of those out Im not sure if having the method as
> string is right for what im wanting to do
> One problem im having is that I want multiple values to be returned by
> the webservice but this is only returning one here is my altered code

A method only returns one value... but depending on what is consuming
it, perhaps you could return an array, or a hashtable, or some
collection.  That way you could include multiple values in a single
return object.  I haven't coded any webservices, so I don't know if this
fits inside the rules or not.  If so, you will probably have to
serialize whatever object you return and de-serialize it in the
receiver.

>               [WebMethod]
>               public string CTX(string filter)
>               {
>                       try
>                       {
>                               string result = "Nothing";
>                               string result2 = "Still Nothing";
>                               iDB2Connection cn = new
> iDB2Connection("Datasource=TDC01;userid=RDS;password=sootarsing;DefaultCollection=QGPL;");
>                               cn.Open();
>                               string sqlstmt = "Select * from ctx4nthg
> where REF ='"+@filter+"'";
>                               iDB2Command cmd = new
> iDB2Command(sqlstmt,cn);
>                               iDB2DataReader dr =
> cmd.ExecuteReader();
>                               int TYPE = dr.GetOrdinal("TYPE");
>                               int FUND = dr.GetOrdinal("FUND");
> 
>                               while (dr.Read())
>                               {
>                                result = (string)dr[TYPE];
>                                result2 = (string)dr[FUND];
>                                       //return result;
>                               }
>                               return result;
> 
>                               dr.Close();
>                               
>                       }
>                       catch (Exception e)
>                       {
>                               return "Error: " + e.Message;   
>                       }

Personally, I don't like multiple returns, but at least this should
compile.

Joel


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.