471,330 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Re: best method of querying

cj2
Thank you!

cfps.Christian wrote:
On Jun 27, 10:28 am, cj2 <c...@nospam.nospamwrote:
>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.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.Odbc;

namespace CWebService1
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using
ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{

[WebMethod()]
public string CashOnly(string act)
{
DataSet ds = new DataSet();
OdbcConnection myOdbcConnection = new
OdbcConnection("Driver={Microsoft Visual FoxPro Driver};" +
"SourceType=DBF;" + "SourceDB=\\\\fileserver\\i\\probill\\;" +
"Exclusive=No;" + "Collate=Machine;" + "NULL=NO;" + "DELETED=NO;" +
"BACKGROUNDFETCH=NO");

OdbcCommand myOdbcCommand = new OdbcCommand("select flag
from \\\\fileserver\\i\\probill\\act_frau.dbf where act = '" + act.Trim
+ "'", myOdbcConnection);
myOdbcConnection.Open();
string results = myOdbcCommand.ExecuteScalar();
myOdbcConnection.Close();

return results;

}
}

}

act.Trim is a method and therefore must have parenthesis

act.Trim should be act.Trim()
Jun 30 '08 #1
0 739

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by FLEB | last post: by
10 posts views Thread by Bob Bedford | last post: by
2 posts views Thread by Joe Bloggs | last post: by
2 posts views Thread by Steven Cheng [MSFT] | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.