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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:06:38+00:00 2026-05-27T12:06:38+00:00

I have created web service in c#.In that admin panel when admin edit file

  • 0

I have created web service in c#.In that admin panel when admin edit file name with escape sequence character it gives error. i want to add ‘s in the audio file name.But when i update that filename it gives an error.please suggest me the code.here is my current code:
for ex:i want file name like: stafford’s.mp3

                  protected void dbUpdate(int Id, string newfileName,string newfilePath,string newfileExt,string newfileType )
{
    string filep;
    if (newfileType == "Image")
    {
        filep = newfilePath + newfileType + "/" + newfileName.Replace(" ", string.Empty) + newfileExt;
    }
    else 
    {

        filep = newfilePath + newfileType + "/" + newfileName.Replace(" ", string.Empty) + newfileExt;
    }

    String getSQL1 = "UPDATE tbluploadedfilesdetail set FileName='" + newfileName + "' FilePath= '" + filep + "' where ID=" + Id + ";";
    MySqlConnection objMyCon1 = new MySqlConnection(connection);
    objMyCon1.Open();
    MySqlCommand cmd2 = new MySqlCommand(getSQL1, objMyCon1);
    cmd2.ExecuteNonQuery();
    objMyCon1.Close();
  • 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-05-27T12:06:38+00:00Added an answer on May 27, 2026 at 12:06 pm

    if you replace single quote with double single quote, it will solve you problem.

    ... set FileName='" + newfileName.Replace("'", "''") + "' ...
    

    You should be using SqlParameters instead of substituting values directly into your sql. So look up SqlParameters.

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

Sidebar

Related Questions

I have a web service that I created in C# and a test harness
I have created a timeclock application in C# that connects to a web service
i have created a web service that will we accessible to only authenticated user
I have a created web service that takes 2 complex types as parameters. I
I have created an Ajax enabled WCF web service that contains this simple method:
I have created a REST web service that, on Application_Start, subscribes to another service
I have created a REST Web Service that in all other ways is working
I have created a custom SharePoint web service that was deployed to, and successfully
I have created one web service that will may called from web using jQuery
I have created a WCF web service that connects to an XMPP service with

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.