日期:2014-05-16 浏览次数:20436 次
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; using MySql.Data; namespace testConn { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { MySqlConnection conn = new MySqlConnection(); conn.ConnectionString = "server=localhost;uid=root;port=3306;database=mytest;"; conn.Open(); if (conn.State == ConnectionState.Open) { MessageBox.Show("MySql connected successfully!"); } } } }