C#连接EXCEL数据库
using System.Data.OleDb; //命名空间 private void button1_Click(object sender, EventArgs e) { string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=student.xls; Extended Properties=Excel 8.0;"; OleDbConnection conn = new OleDbConnection(strConn) string sql = "select * from [student$]"; //注意EXCEL数据库表形式 OleDbCommand cmd = new OleDbCommand(sql, conn); OleDbDataAdapter oda = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); oda.Fill(ds,"stud...
C#连接EXCEL数据库
using System.Data.OleDb; //命名空间 private void button1_Click(object sender, EventArgs e) { string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.xls; Extended Properties=Excel 8.0;"; OleDbConnection conn = new OleDbConnection(strConn) string sql = "select * from [student$]"; //注意EXCEL数据库表形式 OleDbCommand cmd = new OleDbCommand(sql, conn); Ol...