View Single Post
  #4 (permalink)  
Old 09-01-2006, 12:18 PM
Saint Saint is offline
Learning Programmer
 
Join Date: Aug 2006
Posts: 63
Rep Power: 9
Saint is on a distinguished road
Default

I found this which is in C# but you port it to managed C++


You need to download and install this:
http://dev.mysql.com/downloads/connector/net/1.0.html

Code:
			string MyConString = "SERVER=localhost;" +
				"DATABASE=mydatabase;" +
				"UID=testuser;" +
				"PASSWORD=testpassword;";
			MySqlConnection connection = new MySqlConnection(MyConString);
			MySqlCommand command = connection.CreateCommand();
			MySqlDataReader Reader;
			command.CommandText = "select * from mycustomers";
			connection.Open();
			Reader = command.ExecuteReader();
			while (Reader.Read())
			{
				string thisrow = "";
				for (int i= 0;i<Reader.FieldCount;i++)
						thisrow+=Reader.GetValue(i).ToString() + ",";
				listBox1.Items.Add(thisrow);
			}
			connection.Close();
Taken from http://bitdaddys.com/MySQL-ConnectorNet.html
__________________
Hi >> Saint
Reply With Quote