ASP.netÁ¬½ÓExcel
Ê×ÏÈÌí¼ÓÃüÃû¿Õ¼ä
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
strfile = Request.QueryString["filename"];//´ÓÆäËûÒ³Ãæ´«¹ýÀ´µÄÎļþ·¾¶
Excel(strfile);
}
}
private void Excel(string filepath)
{
try
{
Dataset ds = new DataSet();
string ConnStr = "Provider=Microsoft.Jet.OleDb.4.0;data source=" + filepath +
";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";//Á¬½ÓExcelµÄ×Ö·û´®
string query = "SELECT * from [student$]";//ExcelÖеıíÃû³Æ
OleDbCommand oleCommand = new OleDbCommand(query, new OleDbConnection(ConnStr));
OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
oleAdapter.Fill(ds, "[student$]");
rowcount = ds.Tables[0].Rows.Count;
gridview1.DataSource = ds;
gridview1.DataBind();
lblmes.Text = "ÉÏ´«³É¹¦£¬Êý¾ÝÈçÏÂËùʾ£¬ÇëÈ·ÈÏ£º";//lblmesΪlabel£¬ÏÔʾÌáʾÐÅÏ¢
}
catch (OleDbException)
{
string filename = filepath.Substring(filepath.LastIndexOf('/') + 1);
lblmes.Text = "´íÎó£¡ÇëÈ·ÈÏÉÏ´«ÎļþÊÇ·ñÕýÈ·£¡µ±Ç°ÉÏ´«µÄÎļþΪ£º" + filename;
lbtnSure.Visible = false;
}
catch(Exception ee)
{
lblmes.Text = ee.Message;
}
}
Ïà¹ØÎĵµ£º
ÈçºÎ£ºÔÚ ASP.NET ÍøÒ³ÖÐʵÏֻص÷
ÔÚ¿Í»§¶Ë»Øµ÷ÖУ¬¿Í»§¶Ë½Å±¾º¯Êý»áÏò ASP.NET ÍøÒ³·¢ËÍÇëÇ󣬸ÃÍøÒ³Ëæºó»áÔËÐÐÆäÕý³£ÉúÃüÖÜÆÚµÄ¼ò»¯°æ±¾ÒÔ´¦Àí¸Ã»Øµ÷¡£ÈôҪȷ±£»Øµ÷ʼþÔ´ÓÚÔ¤ÆÚµÄÓû§½çÃæ (UI)£¬¿ÉÒԶԻص÷½øÐÐÑéÖ¤¡£Ôڻص÷ÑéÖ¤ÖУ¬Ó¦ÏÈÔÚÍøÒ³³ÊÏÖ¹ý³ÌÖÐ×¢²áÒªÑéÖ¤µÄʼþ£¬È»ºóÔڻص÷¹ý³ÌÖжԸÃʼþ½øÐÐÑéÖ¤¡£Óйػص÷µ ......
ASP.NET AJAXÍÆ³öÒ²ÓÐÒ»¶Îʱ¼äÁË£¬µ±³õÐû³ÆµÄAJAX¿Í»§¶Ë½Å±¾¿ÉÒÔÍÑÀë·þÎñÆ÷¶Ë½Å±¾£¬ÔÚÖîÈçhtml,phpµÈƽ̨ÉÏʹÓ㬵«Ïñ΢Èí²»ÉÙÆäËû²úÆ·Ò»Ñù£¬Õâ¸ö·Ê´óµÄ£¬ÐÔÄܵÍÏ£¬ºÁÎÞÒÕÊõ¸ÐµÄ¿ò¼ÜÕýÔÚ±»´ó¼ÒËùÚ¸²¡¡£Ô½À´Ô½¶àµÄÈËÏëÒªÍÑÀëÕâ¸ö¿Í»§¶Ë½Å±¾£¬ÍÑÀëAJAXÌṩµÄ¿Í»§¶Ë¿Ø¼þ£¬Óøü¾«Á¶¸ü¸ßЧµÄ¿ò¼ÜÀ´µ÷Ó÷þÎñÆ÷¶Ë·½·¨¡£ºÜÏÔÈ»£¬Ä¿ ......
ºÜ¶àµØ·½¶¼Ó¦Óõ½Í¼Æ¬ÉÏ´«¹¦ÄÜ£¬ÄÇô¾¿¾¹ÔõÑù¿ÉÒÔʵÏÖÄØ?ÏÂÃæÎÒÀ´¸ø´ó¼Ò½øÐн²½â
ÔÚvisual studioÖÐ×Ô´øµÄÒ»¸ö¿Ø¼þfileupload£¬¿ÉÒÔʵÏִ˹¦ÄÜ£¬ÎÒÒª¸ø´ó¼Ò½éÉܵÄÊÇËüµÄÓ÷¨¡£
Ê×ÏÈҪн¨Ò»¸öÍøÒ³£¨ÏÂÃæÊÇÎÒ´´½¨ºÃµÄÒ»¸öÍøÒ³£©
ÔÚÍøÒ³ÖÐÍϽøfileupload¿Ø¼þ£¬ºóÃæ·ÅÒ»¸öÉÏ´«°´Å¥
ÕâÑù£¬µ±ÎÒÃǵã»÷ÉÏ´«°´Å¥Ê±£¬Í¼ ......
ÔÚ IIS 6.0 Öв¿ÊðASP.NET MVC³ÌÐò
1¡¢°²×°ASP.NET MVC¿ò¼Ü³ÌÐò
AspNetMVC1.msi ÏÂÔØµØÖ·£º
http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&displaylang=en
2¡¢ÉèÖÃIIS
1£© ......
ASP.NETÌṩµÄÕ¾µãµØÍ¼ÎªÎÒÃǽ¨Á¢µ¼º½À¸ºÍ²Ëµ¥ÌṩÁ˼«´óµÄ·½±ã¡£´ËÍâÎÒÃÇ»¹¿ÉÒÔ½¨Á¢×Ô¼ºµÄÕ¾µãµØÍ¼Ìṩ³ÌÐò£¬´Ó¶øÊ¹ÎÒÃǵIJ˵¥Ïî¿É¿Ø¡£
ÏÈÀ´Á˽âÏÂmenuµÈµ¼º½¿Ø¼þÓëÕ¾µãµØÍ¼µÄ¹ØÏµ¡£ÎÒÃÇÔÚASP .NETÏîÄ¿ÖÐËù½¨Á¢µÄweb.siteMap Æäʵ¾ÍÊÇÒ»¸ö× ......