C# .NET 连接 MySQL 数据库
时间:2011-01-06 来源:zhanqi
// using MySql.Data.MySqlClient; 下载 string connStr = "server=localhost;port=3306; uid=root; pwd=root; database=dbname"; using (MySqlConnection conn = new MySqlConnection(connStr)) { conn.Open(); DataTable dt = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter("select * from 表名", conn); da.Fill(dt); dataGridView.DataSource = dt; }
附:
相关阅读 更多 +