0

Can someone provide with me some code to connect to a MySQL database and check the whole of one column to see if it is less than 2?
I've looked online and have found nothing which can help.

Thanks so much, Lawrence

8
  • 1
    I get this as the first google result for "connect to mysql using C#" bitdaddys.com/MySQL-ConnectorNet.html. I'm not saying this to push google, but to point out that it doesn't seem that you looked very far before asking this question, and you will get much better responses if you do some legwork first and ask more specific questions. Commented Feb 24, 2010 at 21:54
  • No We wont do your homework for you. Give it a decent try, post what you got when you get stuck. Then we'll help you. Voting to Close as "Not a real question" Commented Feb 24, 2010 at 21:56
  • Ahh great. Sorry, when I Googled I found nothing. Thanks though :) Commented Feb 24, 2010 at 21:57
  • Nifle, this isn't homework.. I'm writing this code for pleasure. I'm not asking you to do my homework. Commented Feb 24, 2010 at 21:57
  • @Lawrence - Fair enough. Follow Eric's advice, do some coding and come back when it breaks. Then you'll have a very good chance of getting great help. -- Another point if you start your comment with @Nifle or @Eric we'll get notified by the system. Useful if you are commenting on somthing and want to make sure it is read. Commented Feb 24, 2010 at 22:05

2 Answers 2

2

A good first step is to download MySQL's Connector/Net; the current version is 6.2.2.

Unfortunately, I'm terribad at dealing with .NET's TableAdapters and Dataset Designer stuff, but those links may be useful.

Sign up to request clarification or add additional context in comments.

Comments

1

You need to install these components described in this article. You can use any ADO.NET tutorial as a guide for how to query the database except you will be using MySqlConnection and other MySql* objects instead. There is example VB.NET code in the article that is very similar to the C# you would use.

http://www.15seconds.com/issue/050407.htm

Here's plenty of C# code: http://www.functionx.com/mysqlnet/csharp/Lesson02.htm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.