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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:24:14+00:00 2026-06-04T12:24:14+00:00

Error msg: You have an error in your SQL syntax; check the manual that

  • 0

Error msg:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘desc) VALUES(‘223’, ‘hhh’)’ at line 1

If i erase ‘desc’ from the query, then it code is functioning. so i believe there is nothing wrong with the code/query.

this is how i designed the front-end and MySQL

txtTitle is a Textbox with Single line, txtDesc is a Textbox with Multiline

i put title as VARCHAR(45) and desc as VARCHAR(1000)
This is my code:

string connectionString = @"server=max-5.com.my;userid=user; password=123456;database=myDatabase";


MySqlConnection conn = new MySqlConnection(connectionString);

MySqlCommand cmd = conn.CreateCommand();



cmd.Parameters.Add("title", MySqlDbType.VarChar);

cmd.Parameters["title"].Value = this.txtTitle.Text;



cmd.Parameters.Add("desc", MySqlDbType.VarChar);

cmd.Parameters["desc"].Value = Server.HtmlEncode(this.txtDesc.Text);



cmd.CommandText = "INSERT INTO application(title, desc) VALUES(@title, @desc)";



conn.Open();

int numberOfRows = cmd.ExecuteNonQuery();

conn.Close();

Response.Redirect("Page2.aspx");
  • 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-04T12:24:15+00:00Added an answer on June 4, 2026 at 12:24 pm

    You are using desc as a field name, which is a reserved keyword. Use backticks around it in the query:

    cmd.CommandText = "INSERT INTO application(title, `desc`) VALUES(@title, @desc)";
    

    Alternatively, rename the field.

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

Sidebar

Related Questions

error msg: 1064 - You have an error in your SQL syntax; check the
Trying to use: :On Error exit :r D:\opt\db_objects\REPORTS\dbo.sp_ReportCountLORUsers.sql ...and I get: Msg 102, Level
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
Hello I have an extended stored procedure that sends an error message. srv_sendmsg(pSrvProc, SRV_MSG_ERROR,
when i submit the form.. the form display the 'error' msg that mean the
if i try to run following code in sql server 2005 i get error
I have a javascript function called GetRequest() that calls the server with $.ajax() and
I have the following code that suppose used to Send Data to Server using
This Codes give me error: Msg 156, Level 15, State 1, Procedure DefaultActivity, Line
Query gives me some error: Msg 156, Level 15, State 1, Line 4 Incorrect

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.