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

  • Home
  • SEARCH
  • 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 8999565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:11:49+00:00 2026-06-16T00:11:49+00:00

I have the followinf web service in asp.net //setup profile [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)]

  • 0

I have the followinf web service in asp.net

//setup profile
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void SetProfile(string userName, string firstName, string lastName, string imageUrl)
    {
        //create and open connection
        NpgsqlConnection profileConnection = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["PrevueConnString"].ToString());
        profileConnection.Open();

        //create query and command
        string query = "INSERT into \"Users\" (\"FirstName\", \"LastName\", \"ImageUrl\") values(:fname, :lname, :imageUrl) where \"UserName\" = :user";
        NpgsqlCommand profileCommand = new NpgsqlCommand(query, profileConnection);

        profileCommand.Parameters.Add(new NpgsqlParameter("user", DbType.String));
        profileCommand.Parameters.Add(new NpgsqlParameter("fname", DbType.String));
        profileCommand.Parameters.Add(new NpgsqlParameter("lname", DbType.String));
        profileCommand.Parameters.Add(new NpgsqlParameter("imageUrl", DbType.String));

        profileCommand.Parameters[0].Value = userName;
        profileCommand.Parameters[1].Value = firstName;
        profileCommand.Parameters[2].Value = lastName;
        profileCommand.Parameters[3].Value = imageUrl;

        int result = profileCommand.ExecuteNonQuery();

        profileCommand.Dispose();
        profileConnection.Close();

        string json = new JavaScriptSerializer().Serialize(result);
        Context.Response.Clear();
        Context.Response.ContentType = "application/json";
        Context.Response.Flush();
        Context.Response.Write(json);
    }

On invoking the web service, I get the following error:

Npgsql.NpgsqlException: ERROR: 42601: syntax error at or near "where"

  • 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-16T00:11:50+00:00Added an answer on June 16, 2026 at 12:11 am

    I guess i figured out the error, i used the ‘Where’ clause with an Insert command, changed that to Update and things are smooth now… 🙂 Appreciate your help..!!

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

Sidebar

Related Questions

I have a basic web service that returns the following object as JSON: public
I have created a new VS2008 ASP.Net Web service project, with the default name
Given the following setup, I have three assemblies. Web (ASP.NET MVC 3.0 RC1) Models
I have an ASP.NET web service (.asmx). My service is defined like the following:
Consider an ASP.NET Web API service that redirects public class ThisController : ApiController {
I have developed in c# 2 applications. One ASP .NET web service and a
Here is what I have so far. I am creating an ASP.NET Web service
I have a asp.net 2.0 web site with WCF service hosted inside it running
I have a data table in my ASP.NET web service project, this data table
I have a jquery ajax call asp.net web service question. I want to validate

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.