Hello everyone,

I am new to mySQL. I want to know how to use mySQL with c#, and if there is any difference between MS SQL and mySQL.
Also any links to tutorials would be great.

Thanks

I was hoping someone with more specific experience would reply, but so far no takers.

Well....I am very experienced with both MSSQL and MySQL. ANSI standard SQL is the same on all RDBMS. However, most database systems have their own extension functions. For example, a common T-SQL (Microsoft's Transact-SQL) function I used a lot was ISNULL(). You won't have that in MySQL. MySQL has a handy MD5() function to encrypt a string. I don't think T-SQL has that function. There are a lot of functions like this that are different between the two, but the basics of writing queries is identical--that is all the rules regarding SELECT, FROM, INNER, WHERE, GROUP BY, ORDER BY, etc.

Now if you are used to using Stored Procedures and User-Defined Functions in MSSQL, you won't have those in anything before MySQL 5--which is brand new and not supported by most hosts yet. (Most hosts are probably still using MySQL v3.2 or so.)

All in all, I found it very easy to make the transition from a code perspective.

As for using MySQL in C#, I can't speak directly to that, but it should be the same as using any other database. You can create a DSN on your system and then use the ODBC class libraries in the .NET Framework.

Enjoy the journey.

Thanks for the advice. How can you start a database with mySQL (that is also what I am having trouble with), and how do you get the DSN and other connection information from mySQL. Thanks

Well, to get started with MySQL, I recommend you go check out my WAMP HOWTO at http://www.troywolf.com/articles. You can just skip to the MySQL part if that is all you need.

I'm making the assumption you are working with Windows since you are talking about C#. I'm not a C# programmer, but I took a 5-day C# class. I really like the language. If you know C#, you'll find PHP easy to work with--if you ever decide to take that road.

As far as creating a DSN, I know I mentioned that in my previous post, but honestly, I've never setup a DSN for MySQL. Also, I've never used ODBC with MySQL--although I'm sure it works just dandy. I've always used PHP's native functions for MySQL. My HOWTO talks you through installing the MySQL "Essential" installation. Maybe you should instead go for the full package install. I think it comes with ODBC drivers for Windows as well as a GUI tool for database admin. I really wish somebody else on the forum here who knows exactly about this would help you. With 44,000+ members, I'm sure ONE of them uses MySQL with ODBC on Windows. :)

When you get it all working, come back here with a follow-up post. Thanks!

Thanks for the help Troy, you actually got me curious about PHP too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.