日期:2014-05-20 浏览次数:20753 次
string conStr = "server=Microsoft.Jet.OLEDB.4.0;database=mysql;user id=jason;pwd=jason;"; OdbcConnection con = new OdbcConnection(conStr); OdbcCommand cmd = new OdbcCommand(); cmd.CommandText = "select * from host"; cmd.Connection = con; con.open(); OdbcDataAdapter adapter = new OdbcDataAdapter(cmd); DataSet ds = new DataSet(); adapter.Fill(ds, "t1"); dataGridView1.DataSource = ds.Tables["t1"];