Asp.Net ¶ÁÈ¡Excel
½ñÌìΪÁË×ö²åÈëÊý¾ÝÕÒÁ˲»ÉÙ¶«Î÷£¬ÒòΪ´ÓÀ´Ã»ÓÐд¹ý¶ÁдExcel£¬Ò²²»ÖªµÀ¸ÃÔõôд¡£ÏÂÃæµÄÊǽñÌìͨ¹ý²é¿´ÂÛ̳×Ô¼ºÐ´³öÀ´ÁË¡£
¹¦ÄÜÊǶÁÈ¡Excel È»ºó°ÑÊý¾Ý²åÈëÊý¾Ý¿â¡£Õâ¸ö¹¦ÄÜÔÚÆóÒµÀïÊǷdz£³£¼ûµÄÒ²Êdz£Óõģ¬Ï£Íû¶ÔÅóÓÑÃÇÓаïÖú£¡
/// <summary>
/// µ¼Èëexcel
/// </summary>
/// <param name="filepath">Îļþ¾ø¶Ô·¾¶</param>
/// <param name="sheetname">Excel±íÃû</param>
/// <returns></returns>
private DataSet ExcelDataSource(string filepath, string sheetname)
{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "$]", strConn);
DataSet ds = new DataSet();
oada.Fill(ds);
return ds;
}
protected void Page_Load(object sender, EventArgs e)
{
string filePath = @"E:\н¨Îļþ¼Ð (2)\³¤°²ÇøÊý×ÖµØÃûµÇ¼Ç±í.xls";
DataSet ds = ExcelDataSource(filePath, "Sheet1");
DataTable dt = ds.Tables[0];
///DateTableÒѾ°ÑExcelµÄÊý¾Ý¶ÁÈ¡³öÀ´È»ºó¾Í²åÈëÄãµÄÊý¾Ý¿â°É£¡
}
Ïà¹ØÎĵµ£º
״̬¹ÜÀíÊÇÄú¶Ôͬһҳ»ò²»Í¬Ò³µÄ¶à¸öÇëÇóά»¤×´Ì¬ºÍÒ³ÐÅÏ¢µÄ¹ý³Ì¡£ÓëËùÓлùÓÚ HTTP µÄ¼¼ÊõÒ»Ñù£¬Web ´°ÌåÒ³ÊÇÎÞ״̬µÄ£¬ÕâÒâζ×ÅËüÃDz»×Ô¶¯Ö¸Ê¾ÐòÁÐÖеÄÇëÇóÊÇ·ñÈ«²¿À´×ÔÏàͬµÄ¿Í»§¶Ë£¬»òÕßµ¥¸öä¯ÀÀÆ÷ʵÀýÊÇ·ñÒ»Ö±Ôڲ鿴ҳ»òÕ¾µã¡£´ËÍ⣬µ½·þÎñÆ÷µÄÿһÍù·µ¹ý³Ì¶¼½«Ïú»Ù²¢ÖØд´½¨Ò³£»Òò´ ......
ÔÚÐí¶àÓ¦ÓóÌÐòÖУ¬ÐèÒª´æ´¢²¢Ê¹ÓöÔÓû§Î¨Ò»µÄÐÅÏ¢¡£Óû§·ÃÎÊÕ¾µãʱ£¬Äú¿ÉÒÔʹÓÃÒÑ´æ´¢µÄÐÅÏ¢ÏòÓû§ÏÔʾ Web Ó¦ÓóÌÐòµÄ¸öÐÔ»¯°æ±¾¡£¸öÐÔ»¯Ó¦ÓóÌÐòÐèÒª´óÁ¿µÄÔªËØ£º±ØÐëʹÓÃΨһµÄÓû§±êʶ·û´æ´¢ÐÅÏ¢£¬Äܹ»ÔÚÓû§ÔٴηÃÎÊʱʶ±ðÓû§£¬È»ºó¸ù¾ÝÐèÒª»ñÈ¡Óû§ÐÅÏ¢¡£ÈôÒª¼ò»¯Ó¦ÓóÌÐò£¬¿ÉÒÔ ......
ASP.NET ÅäÖÃÎļþ¹¦ÄÜÓë ASP.NET ³ÉÔ±×ʸñ¡¢ASP.NET ½ÇÉ«¹ÜÀíÒÔ¼°ÆäËû ASP.NET ¹¦ÄÜʹÓÃͬһ»ùÓÚÌṩ³ÌÐòµÄ½á¹¹¡£ASP.NET ÅäÖÃÎļþ¹¦ÄÜÊÇÒ»¸ö·Ö²ãϵͳ£¬ÆäÖÐÅäÖÃÎļþ¹¦ÄܵŦÄÜ£¨ÌṩÀàÐÍ»¯ÊôÐÔÖµ²¢¹ÜÀíÓû§±êʶ£©Óë»ù´¡Êý¾Ý´æ´¢Çø·ÖÀë¡£ÅäÖÃÎļþ¹¦ÄÜÒÀÀµÓÚÅäÖÃÎļþÌṩ³ÌÐò£¨Êý¾ÝÌṩ³ÌÐò£©À´Ö´Ðд洢ºÍ¼ìË÷ÅäÖÃÎļþÊôÐÔ ......
Èý²ã¼Ü¹¹(3-tier application) ͨ³£ÒâÒåÉϵÄÈý²ã¼Ü¹¹¾ÍÊǽ«Õû¸öÒµÎñÓ¦Óû®·ÖΪ£º±íÏֲ㣨UI£©¡¢ÒµÎñÂß¼²ã£¨BLL£©¡¢Êý¾Ý·ÃÎʲ㣨DAL£©¡£Çø·Ö²ã´ÎµÄÄ¿µÄ¼´ÎªÁË“¸ßÄÚ¾Û£¬µÍñîºÏ”µÄ˼Ïë¡£
1¡¢±íÏֲ㣨UI£©£ºÍ¨Ë×½²¾ÍÊÇÕ¹ÏÖ¸øÓû§µÄ½çÃ棬¼´Óû§ÔÚʹÓÃÒ»¸öϵͳµÄʱºòËûµÄËù¼ûËùµÃ¡£
2¡¢ÒµÎñ ......