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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:54:03+00:00 2026-06-14T16:54:03+00:00

As a reaction to MySqlParameter as TableName , it seems that MySQL’s Connector/NET library

  • 0

As a reaction to MySqlParameter as TableName, it seems that MySQL’s Connector/NET library doesn’t support table names from user input in the following way:

MySqlCommand cmd = new MySqlCommand("SELECT * FROM @table");
cmd.Parameters.AddWithValue("@table",TableNameFromUserInput);

So I tried to find another way, but I couldn’t find any libraries that did this for me.

When searching for how to do this manually, I couldn’t found anything that didn’t tell you to use “prepared statements” from some already defined library, no matter the language.

To my limited knowledge of SQL, I only think it’s necessary to put backticks (`) around the user input and then check the input for backticks – but I wanted to be sure.

Question

How do you protect a user specified table name from SQL-Injection when the MySQL Connector doesn’t support it?

  • 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-14T16:54:04+00:00Added an answer on June 14, 2026 at 4:54 pm

    Check if

    TableNameFromUserInput
    

    is an existing table, before executing the query.
    That prevents other errors like “table doesnt exist” aswell.

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

Sidebar

Related Questions

I get a very confusing reaction from my ant build-file and I'm wondering whether
I made a while ago some code that adds an object to my table
Need to make a reaction. When you press the button on the ItemsControl that
I have a soap web service with method: string startReaction(object reaction); Inside that method
I guess that most people that use Visual Studio had my same reaction when
After reading this question , my first reaction was that the user is not
I had this idea and my first reaction after having it was That's a
In my app people can read newsmessages and add a reaction etcetra. The articels
I am using primeface 3.2. i am using ajax poll to get every reaction
I know my gut reaction to global variables is badd! but in the two

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.