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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:49:44+00:00 2026-06-05T21:49:44+00:00

Error display as Incorrect syntax near ‘@Cmp_DocPath’, if i use comment Line code I

  • 0

Error display as “Incorrect syntax near ‘@Cmp_DocPath’, if i use comment Line code I got the Error as “An sqlparameter with parametername ‘@Cmp_DocPath’ is not contained by this sqlparametercollection”.How i get the Filename of the AsyncFileUpload AJAX control ?

    protected void BtnCmpApproval_Click(object sender, EventArgs e)
    {
      SqlConnection SqlCon = new SqlConnection(GetConnectionString());
        string query = "INSERT INTO User_Info2 VALUES     (@lblCmpUserName,@txtCmpName,
      @txtRegCountry,@txtCmpRegNo,@txtCmpEstdate,@txtCmpAddress,@ddlAddrIn)";
        try
        {
            SqlCon.Open();
            SqlCommand cmd = new SqlCommand(query, SqlCon);
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@UserName", lblCmpUserName.Text);
            cmd.Parameters.AddWithValue("@Cmp_Name", txtCmpName.Text);
            cmd.Parameters.AddWithValue("@Commercial_RegNo", txtRegCountry.Text);
            cmd.Parameters.AddWithValue("@Comm_Country", txtCmpRegNo.Text);
            cmd.Parameters.AddWithValue("@Cmp_EstablishDate", txtCmpEstdate.Text);
            //cmd.Parameters.AddWithValue("@Cmp_DocPath", AFU1.FileName);
            cmd.Parameters["@Cmp_DocPath"].Value=AFU1.FileName;
            cmd.Parameters.AddWithValue("@txtCmpAddress", txtCmpAddress.Text);
            cmd.Parameters.AddWithValue("@ddlAddrIn", ddlAddrIn.SelectedItem.Text);
            cmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
           throw new Exception(ex.Message);
        }
        finally
        { 
           SqlCon.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-06-05T21:49:46+00:00Added an answer on June 5, 2026 at 9:49 pm

    You are not adding a parameter with the name @Cmp_DocPath, your code simply assumes that it is already there, and it’s telling you that it’s not. You should add the parameter the same way that you add the other parameters, eg.:

    cmd.Parameters.AddWithValue("@Cmp_DocPath", AFU1.FileName);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

WHat's the best way/code in Login Form (Zend_Form) to display error message 'Login/password incorrect'?
I wrote a php code that display error in red color. But somehow, this
I've got an ASP.NET application, which calls this code at some point, to display
Please is there a way i can make my error display dynamic for only
I want to display error messages e.g SQLException errors in the jsp page that
Many versions of Delphi including Delphi 2010 display Error executing 'D:\ProgramData{BBD31133-40F8-4B57-9BA6-DB76C03D153B}\Setup.exe': The parameter is
I'm writing some if/elsif statements to display error messages. When I leave the username
I'm using the ajax toolkit's ValidatorCalloutExtender to display error messages on a textbox. The
In firefox, the error messages display as should. Just to the right of the
Struts - Alternative of <html:errors /> to display error messages in Jsp?

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.