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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:54:48+00:00 2026-06-18T07:54:48+00:00

try { // Console.WriteLine(wtf); con.ConnectionString = WebConfigurationManager.ConnectionStrings[dbconn].ConnectionString; cmd.Connection = con; cmd.CommandType = System.Data.CommandType.Text; con.Open();

  • 0
               try
                {

                   // Console.WriteLine("wtf");
                    con.ConnectionString = WebConfigurationManager.ConnectionStrings["dbconn"].ConnectionString;
                    cmd.Connection = con;
                    cmd.CommandType = System.Data.CommandType.Text;
                    con.Open();
                    cmd.CommandText = "select count(*) from hr WHERE emp_id=@1)";
                    cmd.Parameters.AddWithValue("@1", emp_id);

                   dr = cmd.ExecuteReader();
                   int count = 0;
                    while (dr.Read())
                     {
                         count = dr.GetInt32(0);
                     }
                     dr.Close();
                     cmd.Dispose();
                     cmd.Parameters.Clear();
                    if (count > 0)
                    {

                        cmd.CommandText = "DELETE FROM hr WHERE emp_id=@1')";
                        cmd.Parameters.AddWithValue("@1", emp_id);
                        cmd.ExecuteNonQuery();
                        res.Write("deleted");
                    }
                    else
                    {
                        res.Write("zero");
                    }
                    con.Close();

                }

I am getting sql error near dr = cmd.ExecuteReader();

Error Message :

 MySql.Data.MySqlClient.MySqlException (0x80004005): 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 ')' at line 1 at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at 
MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at 
MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& 
insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
 at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at 
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at 
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() at 
prod.Controller.HR.HRDel.ProcessRequest(HttpContext context
  • 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-18T07:54:50+00:00Added an answer on June 18, 2026 at 7:54 am

    MySqlClient expects ? parameter char instead of @

    Also I am not sure if 1 is a valid parameter name. Try using ?p_1

    Last, as RhysW stated, there is an extra ') in your DELETE statement and ) in your SELECT statement

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

Sidebar

Related Questions

int i=0; try{ int j = 10/i; } catch(IOException e){} finally{ Console.WriteLine(In finally); Console.ReadLine();
dynamic test = new ExpandoObject(); test.A = ok; try{ Console.WriteLine(test.B); } catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException ex){
The following is okay: try { Console.WriteLine("Before"); yield return 1; Console.WriteLine("After"); } finally {
When i try baking with console .. cake bake model After choosing which table
when I try to open a file for reading in my console application i
I'm getting the following error when I try to do ./app/console doctrine:migrate:diff : [Doctrine\ORM\Mapping\MappingException]
$(item).droppable({ drop: function(event, ui) { console.log(triggered); } }); I try to call drop by
try { if (myBoolean) { while (true) ; } else { System.exit(1); } }
Code using System; internal static class Test { private static void Main() { try
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]

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.