• Advertisement
Sign in to follow this  

[.net] MySql

This topic is 4478 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

Hi guys.. I'm just diving into c++.net (2005 express edition).. I'm just wondering if someone can direct me to a good link (with examples) of how to access mysql databases thru .net I've already installed MySql/Connector for .net, but I'm not sure what I use to access/connect/etc to my db.. Thanks in advance, Bradd

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Quote:
Original post by bradbobak
Hi guys.. I'm just diving into c++.net (2005 express edition).. I'm just wondering if someone can direct me to a good link (with examples) of how to access mysql databases thru .net

I've already installed MySql/Connector for .net, but I'm not sure what I use to access/connect/etc to my db..

Thanks in advance, Bradd



http://dev.mysql.com (right from the horses mouth)

They have a forums etc there that might be very helpful....

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Anonymous Poster
Quote:
Original post by bradbobak
Hi guys.. I'm just diving into c++.net (2005 express edition).. I'm just wondering if someone can direct me to a good link (with examples) of how to access mysql databases thru .net

I've already installed MySql/Connector for .net, but I'm not sure what I use to access/connect/etc to my db..

Thanks in advance, Bradd



http://dev.mysql.com (right from the horses mouth)

They have a forums etc there that might be very helpful....



I just noticed there is a link on the right side of the homepage

MySQL Connector/Net
Generally Available (GA) 1.0.7
Documentation


Share this post


Link to post
Share on other sites
I've got some code I've used to connect/query a MySQL database, it's in C# so I dont know how useful it will be but it hopefully will give you the basic idea of what you need to do:


using MySql.Data;
using MySql.Data.MySqlClient;

...

MySqlConnection MyConnection;

string MyConString = "Server=DbServer;Database=YourDbName;Uid=Username;Pwd=Password;";
MyConnection = new MySqlConnection(MyConString);

//try and make the connection
try
{
MyConnection.Open();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}


Then to issue queries you build a MySqlCommand object containing your query string like so:

//build the command
MySqlCommand TempQuery = new MySqlCommand("select * from foo", MyConnection);

//execute it
MySqlDataReader RetReader = TempQuery.ExecuteReader()

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement