Hi Cj,
I also noticed that the "Act" variable here seems hasn't been declared(or
declared anywhere else?). I've try building the same code and got the same
result and the "Operator '+' cannot be applied to operands of type 'string'
" error does pointing to the "Act.Trim" which should be of method call
syntax such as Act.Trim()
After change it, that error is eliminated.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
I also noticed that the "Act" variable here seems hasn't been declared(or
declared anywhere else?). I've try building the same code and got the same
result and the "Operator '+' cannot be applied to operands of type 'string'
" error does pointing to the "Act.Trim" which should be of method call
syntax such as Act.Trim()
After change it, that error is eliminated.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Date: Fri, 27 Jun 2008 11:28:28 -0400
>From: cj2 <cj2@nospam.nos pam>
>User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
>MIME-Version: 1.0
>Subject: best method of querying
>From: cj2 <cj2@nospam.nos pam>
>User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
>MIME-Version: 1.0
>Subject: best method of querying
>
>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;
>
}
}
>}
>
>
>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;
>
}
}
>}
>
>
Comment