-10

I asked this question yesterday - Create SQL row from one variable in C#. In my opinion it was a genuine, beforehand researched, well formatted and grammatically correct question. When I opened it today I found out it has been downvoted. I am not sure why.

I am quite new to programming and even though, I feel like I learnt a lot since I started this journey 4 months ago, I know I just brushed the surface. Because my knowledge is quite limited, sometimes I am not even sure how to phrase the question for Google and going nowhere with my own research. Services like Stack Overflow are priceless sources of information but I am getting more and more reluctant to ask my own question as I don't want to get downvoted and lose the reputation points.

Can someone let me know what I did wrong and how could I make the question better?

Also, is there any mechanism in place to stop people from randomly downvoting a question? Perhaps my downvote was a result of someone having a bad day?

18
  • 8
    Maybe Tim lost his keys again?
    – Ivar
    Mar 24, 2021 at 9:36
  • 3
    It's one downvote, so it's going to be hard to know for sure why one person didn't like your question. Perhaps they wanted you to specify how you're calling SQL from C# (e.g., a particular library?), or which SQL implementation you're using. I'm not particularly familiar with the subject matter.
    – Ryan M Mod
    Mar 24, 2021 at 9:38
  • 23
    "Also, is there any mechanism in place to stop people from randomly downvoting a question?" No, just like there's no mechanism to stop people from randomly upvoting questions. Mar 24, 2021 at 9:39
  • 4
  • 3
    Also relevant: When is justifiable to downvote a question?.
    – yivi
    Mar 24, 2021 at 9:42
  • 11
    "Because my knowledge is quite limited, sometimes I am not even sure how to phrase the question for Google and going nowhere with my own research" - we may have identified the problem. That is not a good foundation for asking well-researched questions on Stack Overflow in a way that the question and its answers are going to be useful to other people. It also sounds a little like you are biting off more than you can chew if you are already attempting database stuff in that stage of your development.
    – Gimby
    Mar 24, 2021 at 10:10
  • 3
    I don't understand the reaction to this meta question. I looked at the original question and - aside from the issue I describe in my answer here - it is well above standard for questions from new users on Stack Overflow. It really is hard to know "how to phrase the question for Google" sometimes. Now the OP has come here (in itself a sign of far-above-average effort and care) to ask a sincere question about how to improve in the future. And the reception is... downvotes and snark. Mar 24, 2021 at 10:23
  • 1
    Seeing all of this is a strange experience for me, because usually I'm the one snarking and wondering how new users could be failing to put in a bare minimum of effort. But here - wow. I'm starting to feel more sympathetic towards the people who have complained to me about Stack Overflow off-site in the past. Mar 24, 2021 at 10:24
  • 1
    That said: if I were in OP's position (and thus didn't know how to do it), I would have tried c# create sql query from array. Mar 24, 2021 at 10:24
  • 8
    @KarlKnechtel Problems with this question are that it's too broad (asking multiple questions) and opinion-based (we can only guess why it was downvoted). Instead it should only focus on how to improve their question. (On a sidenote, they have been an SO member for 8 years now.) Mar 24, 2021 at 10:35
  • 2
    "In my opinion it was a genuine, beforehand researched, well formatted and grammatically correct question." ... and then you apologized for the "lame question"?
    – Tom
    Mar 24, 2021 at 10:49
  • 2
    @Tom I reject the assertion that I have done any such thing, and I don't appreciate your snark. Downvotes clearly get used far more liberally here than on the main site. Mar 24, 2021 at 10:49
  • 2
    'Also, is there any mechanism in place to stop people from randomly downvoting a question?' well, assuming that such responses happen, (which you have not demonstrated), with sufficient frequency so as to be a problem worth addressing, (which you have not given), what mechanism do you suggest? Mar 24, 2021 at 12:20
  • 5
    Let's try and keep Hanlon's razor closer. On the second subject, the underlying reasons for the downvotes are already explained in the comments and answers below. In particular, you made several jumps into conclusions which are not warranted and do not show research effort nor invite grounds for a fruitful exchange. On the third subject, we don't fully condone the act of voting on the user's content for their activity on Meta, but it can happen.
    – E_net4
    Mar 24, 2021 at 15:42
  • 4
    "Important message received is that I am not welcome to ask my questions here." Again, that is you jumping into conclusions. Consider instead following the guidelines for asking good quality questions, so that the system does not start refusing them. " thank you KarlKnechtel for being a human" Are you implying that everyone else in this Q&A was less than human?
    – E_net4
    Mar 24, 2021 at 15:44

2 Answers 2

12

Downvotes have nothing to do with a question being "genuine", or with the question asker not being able to "find an answer anywhere else".

Voting is anonymous, and asking for users to explain their votes is generally not productive.

Asking for feedback on a single vote is a waste of time: only the voter knows why they voted the way they did, and meta can't read minds.

The reasons for downvoting a question are listed in the tooltip for the downvote button:

  • does not show any research effort

  • it is unclear

  • it is not useful

At the very least, the last two are almost completely subjective. Particularly the last one. In relation to your question on main: A user may feel a question is "not useful" because what the question is asking is fundamentally a bad idea.

Or, also with a possible relation to your question on main, a question may also feel "unclear" when it's asking to do something very unconventional (and/or probably dangerous), with little or no evidence of this approach being actually needed. In this case the "lack of clarity" comes from users not understanding what problem the asker is trying to solve.

These are just guesses on my part. I can't ultimately know why some other user voted (up or down) on your post. But in general, it's always better to ask feedback about the post itself, and not about the votes. Always keeping in mind that a single vote (in any direction) while can be useful feedback, is not necessarily a clear-cut indication of the quality of a post.

10

It is common in my experience to downvote questions that ask about doing things that should not be done. Ideally people should explain this in the comments as well, but it serves a useful purpose to draw attention away from these questions, because one of the primary purposes of Stack Overflow is to provide good results to people who use search engines, and it's better that people who want help with the same problem are not helped and thus don't find the page.

In your particular case, you were asking about dynamically creating a string that would then serve as an SQL query. You should not do this because it is vulnerable to SQL injection. Many real-world systems have been compromised in this way, resulting in millions of accounts being hacked and immense economic damage (1 2). So as you can imagine, there are people floating around who take this sort of thing extremely seriously.

Another common "allergic reaction" is to people who want to use tools with names like eval and exec in languages like Python or Javascript. There are extremely few legitimate use cases for such a powerful tool, and the people capable of identifying them are realistically going to be able to solve the problem themselves. Unfortunately, Python 2.x had a built-in input command that did the equivalent of eval on the supplied input, leading to immense amounts of insecure code in the wild. All that for mere convenience, such as the ability to input an integer without having to convert from string. Python 3.x fixes this issue by requiring you to explicitly invoke eval; unfortunately, a lot of people blindly do this because they don't want to figure out what tool they actually need, and because automated tools (that can't make any assumptions) sometimes blindly produce this code while "converting" 2.x codebases.

2
  • 1
    Side note: there is absolutely nothing wrong in building a parametrized query dynamically - if you know an alternative way to build IN query you are welcome to provide one (stackoverflow.com/a/5681387) Mar 24, 2021 at 18:21
  • Only if you control the parameters strictly. It works there because the values are being converted from integer values, so there isn't a risk of dangerous string content appearing even indirectly. But even so, I would rather dynamically build a string with the required number of placeholders, and then use the library's parameterization functionality. Mar 24, 2021 at 18:30

Not the answer you're looking for? Browse other questions tagged .