string strPath = File1.PostedFile.FileName;
System.Data.OleDb.OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+strPath+";Extended Properties=""Excel 8.0;""");
conn.Open();
System.Data.OleDb.OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM [1$]";
System.Data.OleDb.OleDbDataReader rdr = cmd.ExecuteReader();
DataSet dataSet11 = new DataSet();
这样写对不对?
cmd.CommandText = "SELECT * FROM [1$]";
中的[1$]代表的是不是Excel的名字啊??