真心急啊 

解决方案 »

  1.   

    上传EXCEL到文件夹
    using(OleDbConnection Conn= new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath +";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";"))
    {
                var strCom = " SELECT * FROM " + sheetName;
                Conn.Open();
                var myCommand = new OleDbDataAdapter(strCom,Conn);
                var ds = new DataSet();
                myCommand.Fill(ds);
                Conn.Close();
    }
      

  2.   

    http://www.cnblogs.com/davehuang/archive/2010/07/06/1772226.html方式 很多 ,也可以用 oledb 的形式 写 select语句 就像访问 access 那样,
      

  3.   

    给个方法给你/// <summary>
            /// 读取复杂的对象
            /// </summary>
            /// <typeparam name="T"></typeparam>
            /// <param name="file"></param>
            /// <returns></returns>
            public static List<T> ReadExcel<T>(string file)
            {
                List<T> list = new List<T>();
                string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file + ";Extended Properties='Excel 8.0;IMEX=1'";
                using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connString))
                {
                    using (System.Data.OleDb.OleDbDataAdapter myCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", conn))
                    {
                        conn.Open();
                        DataSet ds = new DataSet();
                        myCommand.Fill(ds, "[Sheet1$]");
                        DataTable dt = ds.Tables[0];                    Type type = typeof(T);
                        PropertyInfo[] infos = type.GetProperties();
                        Dictionary<string, string> dicProperties = new Dictionary<string, string>();
                        foreach (PropertyInfo info in infos)
                        {
                            object[] attributes = info.GetCustomAttributes(typeof(PropertyAttribute), true);
                            if (attributes != null && attributes.Length > 0)
                            {
                                PropertyAttribute pa = (PropertyAttribute)attributes[0];
                                dicProperties.Add(pa.Name, info.Name);
                            }
                        }                    foreach (DataRow row in dt.Rows)
                        {
                            T obj = (T)Activator.CreateInstance(typeof(T));
                            try
                            {
                                Fill<T>(row, dt.Columns, obj, dicProperties);
                            }
                            catch (Exception)
                            {
                                break;
                            }
                            list.Add(obj);
                        }
                    }
                }
                return list;
            }
      

  4.   

    真的啊 谁能教会具体怎么搞 送一年vip  - -!
      

  5.   

    http://blog.csdn.net/happy09li/article/details/7431967
    这个够你消化的了