Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8247323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:48:33+00:00 2026-06-07T22:48:33+00:00

My webservice code [WebService(Namespace = http://tempuri.org/)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService

  • 0

My webservice code

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    SqlConnection con = new SqlConnection(
        "Server=NOVA-PC;database=totev006;User ID=***;Password =***;");

    public Service () { }

    [WebMethod(Description = "Update return in Bet")]
    public string setReturn(int EventID)
    {
        string sql = "";
        decimal dcm = (decimal)100.5 + (decimal)45.055;
        int BetTypeWinID = 1;
        int BettorID = 1;
        int ins = 0;

        con.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;

        sql = "update bet";
        sql += " set [return] = " + dcm;
        sql += " where event_id = " + EventID;
        sql += " and bet_type_id = " + BetTypeWinID;
        sql += " and bettor_id = " + BettorID;

        cmd.CommandText = sql;
        ins += cmd.ExecuteNonQuery();
        con.Close();
        if (ins > 0)
            return "Ok";
        else
            return "not Ok";
    }
}

I get exception and this is the callstack:

System.Data.SqlClient.SqlException: Incorrect syntax near '555'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Service.setReturn(Int32 EventID) in e:\Learning\Webservice\demo\webservice\App_Code\Service.cs:line 49

How to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:48:36+00:00Added an answer on June 7, 2026 at 10:48 pm

    Your system is probably using a locale that formats 123.45 as 123,45.

    Use parameterized queries (see SqlParameter) or be specific in the formatting.

    Whatever you do, DO NOT “just” change the locale setting to “fix” this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following web service that allows me uploading files: [WebService(Namespace = http://tempuri.org/)]
I am inheriting and modifying the System.Net.MailMessage class for use in a web service.
Actually my objective is; Create asp.net web service (namespace ws, class Service1) Create dll
I have an web service named AEWService.asmx with the following code: using System; using
i write a simple webservice code in asp.net when i build the service and
I m developing a coverflow with android-coverflow http://code.google.com/p/android-coverflow/ Items are loaded form a WebService,
I have an AXIS2/JAX-WS web service using a code first implementation (yes I know,
My code calls a Web service method which takes a few minutes to perform
I am working on a code in C#.NET to create a web service that
Using this tutorial: http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx The web service is invoked such as Service1.asmx/HelloToYou The default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.