Simple MySQL Connector/NET in Phalanger
1 post
• Page 1 of 1
Simple MySQL Connector/NET in Phalanger
This is a simple way to use MySQL Connector/NET with Phalanger
Note:
1. Add 'MySql.Data' Assemply to your project from Solution Panel,(Download and install from here)
2. Add a DataGridView to your form and call it 'dataGridView1'.
3. Tested and OK in Visual Studio 2010.
// add the below Namespaceimport namespace System;import namespace System:::Data;import namespace MySql:::Data;import namespace MySql:::Data:::MySqlClient;// ........// ........//Onload of Form1private function Form1_Load(System:::Object $sender, System:::EventArgs $e) { $connStr = "server=localhost;user=root;database=cicot;port=3306;password=;"; $conn = new MySqlConnection($connStr); $sql = "SELECT * from StudentData"; $daStudentData = new MySqlDataAdapter ($sql, $conn); $cb = new MySqlCommandBuilder($daStudentData); $dsStudentData = new DataSet(); $daStudentData->Fill($dsStudentData, "StudentData"); $this->dataGridView1->DataSource = $dsStudentData; $this->dataGridView1->DataMember = "StudentData";}
for more info about MySQL Connector/NET see http://dev.mysql.com/doc/refman/5.1/en/connector-net-tutorials-intro.html
- kielsoft
- Posts: 25
- Joined: March 1st, 2012, 3:39 pm
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest