Sign in to follow this  

C#, C++

This topic is 3103 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
What I dont understand is people's reaction to the sensible choice taken by the team. Linq2Sql is meant to be slim, lite, no frills object mapping to a database. If they continued to build on it then it would no longer be good at what it has come to be known to excel at. It would just be yet another Linq to Entities similike contributing to a confounding paradox of choice. Focusing development on Ado.net linq to entities and simply polishing Linq2Sql is the common sense and economical thing to do.

Share this post


Link to post
Share on other sites

This topic is 3103 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this