This is on the Code Review site. Someone posted their code for building a SQL Connection String.

My answer points them to the Microsoft class whose purpose is to do this exactly:

Prompting user for connection parameters to SQL Server

Then I get a couple of comments saying that "link-only answers are off-topic", which as far as I can see doesn't make sense (maybe he means inappropriate?), and it wasn't just a link - I gave a reason, advice, and signposted to the class - there's nothing else to say. Another comment saying I should paste the linked-to code and describe it, despite linking to documentation for a class, not code.

I asked in the comments for advice on how to improve the answer, if I'd missed some rule or guidance, and got none, simply a deleted, downvoted answer.

I'd really appreciate if someone could fill me in.


All you said was that here's what you need and what the link does.

That's naturally in need of some further explanation and code since if the link dies, no one will be able to see the contents of the link again. Thus, you need to add the appropriate code from the link to your answer and explain the code to the OP how exactly it works and solve the problem at hand. Yes, like @EBrown said, you should always provide the information from the link regardless of the site.

And no, I didn't delete your answer nor am I a moderator for Code Review Stack Exchange,.

  • 1
    \$\begingroup\$ This should apply to any Stack Exchange site - links can die. \$\endgroup\$ – Der Kommissar Jan 3 '17 at 17:47
  • \$\begingroup\$ Ok, I can see that to a degree - I should have posted the name of the class in the answer too, and say "here's the official Microsoft documentation link for that class, valid as of Jan 2017". But that seems like a super-quick edit, so I don't understand the deletion. Unless CR SE is all about giving complete alternatives to the code supplied? (I really didn't think it was, but would eb happy to find out if that's the reason..) \$\endgroup\$ – Kieren Johnstone Jan 3 '17 at 17:49
  • 1
    \$\begingroup\$ It was probably flagged a bunch of times for "not an answer" and was deemed better as a comment. Try posting an answer that is more complete \$\endgroup\$ – Anthony Pham Jan 3 '17 at 17:50
  • \$\begingroup\$ What I mean is, there is now "how exactly it works" I can think of that is necessary, or useful. I don't mean in general - I can see what you mean. But in this precise case? \$\endgroup\$ – Kieren Johnstone Jan 3 '17 at 17:50

Another moderator for Code Review here.

I believe that your answer was a good one, and it was inappropriately converted to a comment. You pointed out a flaw in the code: that it fails to escape values in the connection string. I have edited the answer to explicitly state that observation, reinstated the answer, and upvoted it.

  • \$\begingroup\$ Now that answer is deleted \$\endgroup\$ – Anthony Pham Jan 3 '17 at 17:57
  • \$\begingroup\$ OP posted another answer, which made the original answer redundant. I've re-deleted the original answer now. \$\endgroup\$ – 200_success Jan 3 '17 at 17:58
  • \$\begingroup\$ Interesting how one answer makes his own other answer fall \$\endgroup\$ – Anthony Pham Jan 3 '17 at 17:58

You must log in to answer this question.