Re: Simple C++ .NET connectivity for mySQL
Posted by: w we
Date: November 22, 2004 04:36AM

//in VS add a reference to MySql.Data first

//this should be at the beginning
using namespace MySql::Data::MySqlClient;

private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
String* TablesDbStr = "Database=yourDBname;Data Source=172.26.0.1;User Id=yourMysqlUser;Password=aValidPass";
MySqlConnection* miConn = new MySqlConnection(TablesDbStr);
miConn->Open();
MySqlDataAdapter* categoriesDataAdapter = new MySqlDataAdapter(S"SELECT * FROM categories", miConn);
DataSet* mainDataSet1 = new DataSet();
categoriesDataAdapter->Fill(mainDataSet1, S"Categories");
miConn->Close();
//create dataGrid in designer first
dataGrid1->SetDataBinding(mainDataSet1, S"Categories");
}

Options: ReplyQuote


Subject
Written By
Posted
Re: Simple C++ .NET connectivity for mySQL
November 22, 2004 04:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.