c#链接mysql的问题
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using MySQLDriverCS;
namespace 数据库
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string con, sql;
con = "server=localhost;Database=dianming;User id=root;Password=111111";
sql = "select * from student";
SqlConnection mycon = new SqlConnection(con);
SqlDataAdapter da = new SqlDataAdapter(sql, mycon);
DataSet das = new DataSet();
da.Fill(das, "student");
dataGridView1.DataSource = das.Tables["student"];
}
}
}
按照网上教程打 可是程序运行没反应,也链接不上数据库,哪里错了呢 程序主要是测试数据库是否连接上来
界面图