Simple MySQL Connector/NET in Phalanger

Discussion about the open-source Phalanger [?] project.

Simple MySQL Connector/NET in Phalanger

Postby kielsoft » May 30th, 2011, 2:53 am

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 Namespace
import 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

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 14 guests

cron

User Control Panel

Login

Who is online

In total there are 14 users online :: 0 registered, 0 hidden and 14 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 14 guests