Thank you!
cfps.Christian wrote:
cfps.Christian wrote:
On Jun 27, 10:28 am, cj2 <c...@nospam.no spamwrote:
>
act.Trim is a method and therefore must have parenthesis
>
act.Trim should be act.Trim()
>
>I just converted this from VB and apparently I need to do something else
>in C#. What is the problem with my select statement. I'm getting:
>Operator '+' cannot be applied to operands of type 'string' and 'method
>group'
>>
>using System;
>using System.Collecti ons;
>using System.Componen tModel;
>using System.Data;
>using System.Linq;
>using System.Web;
>using System.Web.Serv ices;
>using System.Web.Serv ices.Protocols;
>using System.Xml.Linq ;
>using System.Data.Odb c;
>>
>namespace CWebService1
>{
> /// <summary>
> /// Summary description for Service1
> /// </summary>
> [WebService(Name space = "http://tempuri.org/")]
> [WebServiceBindi ng(ConformsTo = WsiProfiles.Bas icProfile1_1)]
> [ToolboxItem(fal se)]
> // To allow this Web Service to be called from script, using
>ASP.NET AJAX, uncomment the following line.
> // [System.Web.Scri pt.Services.Scr iptService]
> public class Service1 : System.Web.Serv ices.WebService
> {
>>
> [WebMethod()]
> public string CashOnly(string act)
> {
> DataSet ds = new DataSet();
> OdbcConnection myOdbcConnectio n = new
>OdbcConnection ("Driver={Micro soft Visual FoxPro Driver};" +
>"SourceType=DB F;" + "SourceDB=\\\\f ileserver\\i\\p robill\\;" +
>"Exclusive=No; " + "Collate=Machin e;" + "NULL=NO;" + "DELETED=NO ;" +
>"BACKGROUNDFET CH=NO");
>>
> OdbcCommand myOdbcCommand = new OdbcCommand("se lect flag
>from \\\\fileserver\ \i\\probill\\ac t_frau.dbf where act = '" + act.Trim
>+ "'", myOdbcConnectio n);
> myOdbcConnectio n.Open();
> string results = myOdbcCommand.E xecuteScalar();
> myOdbcConnectio n.Close();
>>
> return results;
>>
> }
> }
>>
>}
>in C#. What is the problem with my select statement. I'm getting:
>Operator '+' cannot be applied to operands of type 'string' and 'method
>group'
>>
>using System;
>using System.Collecti ons;
>using System.Componen tModel;
>using System.Data;
>using System.Linq;
>using System.Web;
>using System.Web.Serv ices;
>using System.Web.Serv ices.Protocols;
>using System.Xml.Linq ;
>using System.Data.Odb c;
>>
>namespace CWebService1
>{
> /// <summary>
> /// Summary description for Service1
> /// </summary>
> [WebService(Name space = "http://tempuri.org/")]
> [WebServiceBindi ng(ConformsTo = WsiProfiles.Bas icProfile1_1)]
> [ToolboxItem(fal se)]
> // To allow this Web Service to be called from script, using
>ASP.NET AJAX, uncomment the following line.
> // [System.Web.Scri pt.Services.Scr iptService]
> public class Service1 : System.Web.Serv ices.WebService
> {
>>
> [WebMethod()]
> public string CashOnly(string act)
> {
> DataSet ds = new DataSet();
> OdbcConnection myOdbcConnectio n = new
>OdbcConnection ("Driver={Micro soft Visual FoxPro Driver};" +
>"SourceType=DB F;" + "SourceDB=\\\\f ileserver\\i\\p robill\\;" +
>"Exclusive=No; " + "Collate=Machin e;" + "NULL=NO;" + "DELETED=NO ;" +
>"BACKGROUNDFET CH=NO");
>>
> OdbcCommand myOdbcCommand = new OdbcCommand("se lect flag
>from \\\\fileserver\ \i\\probill\\ac t_frau.dbf where act = '" + act.Trim
>+ "'", myOdbcConnectio n);
> myOdbcConnectio n.Open();
> string results = myOdbcCommand.E xecuteScalar();
> myOdbcConnectio n.Close();
>>
> return results;
>>
> }
> }
>>
>}
act.Trim is a method and therefore must have parenthesis
>
act.Trim should be act.Trim()
>