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 7833997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:00:17+00:00 2026-06-02T13:00:17+00:00

I have a C# application and the following is an excerpt from my Web.config

  • 0

I have a C# application and the following is an excerpt from my Web.config file:

  <connectionStrings>
    <add name="MyDB" connectionString="Data Source=MACHINENAME\\SQLEXPRESS;Initial Catalog=DBName;Integrated Security=True;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
    <authentication mode="Windows" />
    <identity impersonate="false" />
  </system.web>

In the code itself, I have a query like this:

[WebMethod]
public string InsertField(string str1, string str2, string str3)
{

    string sql = @"
          UPDATE DBNAME.dbo.TableName SET Field2 = '{2}', Modified_At=GETDATE() WHERE Field1 = '{0}' AND Field2 = '{1}';

          IF @@ROWCOUNT = 0
              INSERT INTO DBNAME.dbo.TableName (Field1, Field2, Field3, Modified_At)
              VALUES('{0}', '{1}', '{2}', GETDATE())
            ";

    sql = String.Format(sql, str1, str2, str3);

    try
    {
          string ConString = Constants.connString;
          con = new SqlConnection(ConString);

          cmd = new SqlCommand(sql, con);
          con.Open();
          cmd.ExecuteNonQuery();
          return "Success";
    }
    catch (Exception x)
    {
          return x.Message;
          //Response.Write(x);
     }

}

My web application runs perfectly fine when I debug it but when I publish it, the queries fail. Debugging with Firebug yields the following error:

{
    "d": "The UPDATE permission was denied on the object "TableName", database "DBName", schema "dbo".\r\nThe INSERT permission was denied on the object "TableName", database "DBName", schema "dbo"."
}

Any suggestions on how I can 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-02T13:00:20+00:00Added an answer on June 2, 2026 at 1:00 pm

    Yes, this is a pretty obvious error. You need to make sure that whatever account your web is setup to run as should have access to update/insert the given table.

    As the user seems to not have been set up in the connection string. It will use whatever the web method is running as. So, find out what that account is and grant the appropriate perms. It worked in development because it was probably running under your account, which probably had full access to your dev database.

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

Sidebar

Related Questions

I have the following situation: I have an application that collects some data from
I have application reads in data from text file. Recently I realized that I
I have the following application: I have 1 window. On that window I add
I have a web application which was working well until I converted it from
I have the following Application tag code in my widget: <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml xmlns:local=* width=100%
I have an application that executes the following MySQL query: SELECT 402 AS user_id,
We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I have this application written in JSF 2.0 facelets and it has the following
I have an application that uses Hibernate. It generated the following SQL statement. I
I have set in my mastersite of my asp.net application the following that the

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.