C#, C++

Started by
9 comments, last by Daerax 14 years, 10 months ago
My question is for both c# and c++,just wondering if any database can be used with these languages including MySQL and also which would you recommend and why? + Do you know where I can find any tutorials covering a basic connect to database hello world lesson? preferably c# but either will do.
Advertisement
I haven't gotten that far in my studies as of yet, but both languages can mingle in SQL. I'm not sure how well that works with a MySQL server, but it is basically the same syntax between both, so if you can create a MySQL database you should be able to create a SQL database. Same thing, different software provider.
Quote:if any database can be used with these languages including MySQL

C# can connect to pretty much any database, including MySQL.
Here is a list of some of the database connectors available


System.Data.Odbc, System.Data.OleDb, System.Data.OracleClient, System.Data.SqlClient, MySql.Data.MySqlClient


There is also others, like the sqlite connector

System.Data.SqlClient is Microsofts native database provider and will connect to MS SQL Server databases.
If you want to connect to say MySQL, you will have to install the MySql.Data.MySqlClient connector yourself.

Quote:which would you recommend and why

From my experience both MSSQL Server (including the express version) and MySQL server (community version) is excellent databases. You also get good database management tools for both.
There is a bug in the latest version of the MySQL connector related to the Membership provider so if you are going to utilize membership to its full extent, you might have to install the 5.2 version until that bug is fixed.

Quote:Do you know where I can find any tutorials covering a basic connect to database hello world lesson?

The net is loaded with examples and tutorials on this subject.
Here is one basic tutorial for MSSQL, and here is on for MySQL
I suggest you use google to search for more

edit:
This wiki page might be helpful determining what database is best suited. I believe Oracle is considered the top nodge.

[Edited by - pulpfist on June 18, 2009 11:36:55 PM]
As long as there is a Connector available for the database/langauge combination of your choice, you can connect and use any database you like.

Ok, that's not really an answer. Actually, I just wanted to post this link which has proven very useful to me in the past:
Connection Strings

It lists, for every possible database you could think of the connection string you have to use. With it, you will also be able to identify if the database of your choice supports either C# or C++ depending on what is listed as possible connectors.
Quote:Original post by pulpfist
Quote:if any database can be used with these languages including MySQL

C# can connect to pretty much any database, including MySQL.

As can most other programming languages, including but not excusively C++, C, Delphi, Lisp, Haskell, PHP, Python, Bash, Fortran.

It's really not a matter of language when the language is mighty enough (read: when it's not brainfuck or malbolge), but a matter of available libraries. Even Lisp can spit queries (cliki.net):

(query \"CREATE TABLE a(a INT);               INSERT INTO a (a) VALUES (1); DELETE FROM a; DROP TABLE a\")



And here you find the C++ API. The differences between the APIs are really negligible and one shouldn't decide for one specific language just because one likes the API a tad more, especially because SQL is a language on it's own and has nothing to do with C++ or C# programming.
C# has LINQ and excellent data binding in WinForms and WPF which may also be worth considering.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Quote:Original post by benryves
C# has LINQ and excellent data binding in WinForms and WPF which may also be worth considering.


Though I am unsure if LINQ to SQL is a safe investment at the moment:

* http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx
* http://www.infoq.com/news/2008/11/DLINQ-Future

Also, as it reads (I personally haven't used it so far, but my working fellows do), if you want real database programming, then LINQ might not be appropiate, as it can only represent the intersection of capabilities of (SQL) databases and LINQ. For example: How would you use stored procedures with with LINQ to SQL? And as far as I understand, LINQ to SQL maps the database objects into my running application, and hence a lot of computing time will be transfered from the database server into my application *

* feel free to enlighten me if I am wrong, I am really only talking from my humble unknowledge
Not to mention how frequently LINQ to SQL seems to piss off jpetrie...
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Not to mention how frequently LINQ to SQL seems to piss off jpetrie...


Interesting. *stalks for jpetrie's post*
Quote:
Though I am unsure if LINQ to SQL is a safe investment at the moment:

* http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx
* http://www.infoq.com/news/2008/11/DLINQ-Future

These posts are taking forever to load for me, but I presume they are the ones postulating on the "death" of LINQ to SQL? If so, the counterpoint is
Damien Guard's blog wherein he discusses some of the upcoming changes to the LINQ-to-SQL API in .NET 4 and how the API is not, in fact, "dead." Most of his posts tagged as LINQ related are worth a read.

Quote:
Also, as it reads (I personally haven't used it so far, but my working fellows do), if you want real database programming, then LINQ might not be appropiate,

Depends on what you mean by "real." L2S has a particular design goal in mind, and that goal is essential to provide simple, lightweight language-integrated access to a SQL Server backing store where the database schema closely matches (ideally, exactly matches) your in-language object model for the same data.

In contrast, LINQ-to-Entities is designed for more complex mappings and more complex operations and is backing-store agnostic.

Quote:
as it can only represent the intersection of capabilities of (SQL) databases and LINQ. For example: How would you use stored procedures with with LINQ to SQL? And as far as I understand, LINQ to SQL maps the database objects into my running application, and hence a lot of computing time will be transfered from the database server into my application

You can create mappings to stored procedures either visually from the L2S DBML designer or by hand-editing. L2S translates your LINQ expression tree into Transact-SQL statements which are executed on the server; obviously the expression tree parsing occurs on your local machine, but the actual SQL operation is still run on the database.

Quote:
Not to mention how frequently LINQ to SQL seems to piss off jpetrie...

Quote:
Interesting. *stalks for jpetrie's post*

I've never posted about it on the forums (that I recall), only in IRC. This thread isn't really the appropriate place to go into details though, it's a tad off topic.

This topic is closed to new replies.

Advertisement