473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

RE: best method of querying

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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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 <cj*@nospam.nospam>
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.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;

}
}
}

Jun 30 '08 #1
2 1460
cj2
Thank you!

Steven Cheng [MSFT] wrote:
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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 <cj*@nospam.nospam>
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.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;

}
}
}

Jun 30 '08 #2
You're welcome Cj,

If there is anything else we can help, welcome to post in the newsgroup.

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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

--------------------
>Date: Mon, 30 Jun 2008 15:53:01 -0400
From: cj2 <cj*@nospam.nospam>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Subject: Re: best method of querying
>
Thank you!

Steven Cheng [MSFT] wrote:
>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:
ms****@microsoft.com.
Jul 1 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: FLEB | last post by:
I'm working on a logon system, something generic and modular, as a part of a few ideas I have running. I'm just wondering, though, what is the best way to keep a user logged in authentically...
10
by: Bob Bedford | last post by:
Sorry if I post here, but I don't have access to any valuable mysql ng for this question, ans since 99% or php programmers deal with mysql, I'm sure I'll get an answer here. Look at the...
2
by: Joe Bloggs | last post by:
I have a general question on best practice regarding data access. I have the code below, a static method defined in a class that I use in a data layer dll. The method takes a string as its...
14
by: 42 | last post by:
Hi, Stupid question: I keep bumping into the desire to create classes and properties with the same name and the current favored naming conventions aren't automatically differentiating them......
12
by: jaYPee | last post by:
I have currently using a dataset to access my data from sql server 2000. The dataset contains 3 tables that is related to each other. parent/child/grandchild relationship. My problem is it's very...
6
by: No Spam Man | last post by:
Hi, I am not a programmer and in the past have only created very simple, flat file databases. Although I'm a newbie, I think I could probably figure out basic Boolean logic and financial...
4
by: ajmastrean | last post by:
Folks, What are the best practices, pros/cons, performance, scalability considerations in choosing the source/type for an object's ObjectDataSource (consider a GridView that needs to display a...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
0
by: cj2 | last post by:
Thank you! cfps.Christian wrote:
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.