Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.netºÏ²¢excel

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb; //µ¼ÈëÃüÃû¿Õ¼ä
using System.IO;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Data;
using EnterExcel.BLL;
using EnterExcel.Models;
public partial class JoinExcel : System.Web.UI.Page
{
 protected void Page_Load(object sender, EventArgs e)
 {
  if (!IsPostBack) { }
 }
 private static List<string> listFiles = new List<string>();
 List<Pencil> pencilList = new List<Pencil>();
 //“½«ExcelÌí¼Óµ½¼¯ºÏÖДʼþ
 protected void btnAdd_Click(object sender, EventArgs e)
 {
  listFiles.Add(this.fuSearchExcel.PostedFile.FileName);
 }
 //“µ¼ÈëExcelµ½½çÃæ”ʼþ
 protected void btnJoinExcel_Click(object sender, EventArgs e)
 {
  //±éÀú¼¯ºÏ
  foreach (string listFile in listFiles)
  {
   //½«Excel·¾¶Ñ­»·¸³¸ø·½·¨
   DataTable dt = CreateDataSource(listFile);
   foreach (DataRow row in dt.Rows)
   {
    Pencil pencil = new Pencil();
    pencil.Name = row[0].ToString();
    pencil.Type = row[1].ToString();
    pencil.Number = row[2].ToString();
    pencil.Unit = row[3].ToString();
    pencilList.Add(pencil);
   }
  }
  this.gvInfo.DataSource = LoadExcelFiles(pencilList);
  this.gvInfo.DataBind();
  listFiles.Clear();
 }
 List<Pencil> list = new List<Pencil>();
 public List<Pencil> LoadExcelFiles(List<Pencil> pencilList)
 {
  Pencil p = null;
  for (int i = 0; i < pencilList.Count; i++)


Ïà¹ØÎĵµ£º

ÐÂÊÖ¸ú×ÅѧAsp.net MVC2 Controller

ÉÏ´ÎÎÒÃÇ˵µ½ÁË route ·ÓɵŦÄÜ,Õû¸ömvcÔËÐйý³Ì:
Route(·ÓÉ) --> Controller(¿ØÖÆÆ÷)-->action(·½·¨)
Õâ´ÎÎÒÃÇҪ˵µÄ¾ÍÊÇ controller ¿ØÖÆÆ÷ ºÍ action£º
¿ØÖÆÆ÷µÄ×÷ÓþÍÊÇ£ºµ±Ò»¸ö Request À´µÄʱºò£¬Ê×ÏÈRoute ½âÎö ÕÒµ½ÁË ¶ÔÓ¦ ¿ØÖÆÆ÷£¬¿ØÖÆÆ÷ÔÙ¸ù¾Ý  action ¾ö¶¨¸øÎÒÃÇ·µ»ØʲôÑùµÄÄÚÈÝ¡£È磺
´úÂë ......

ASP.NETÒ³Ãæ´«ÖµµÄ¸÷ÖÖ·½·¨ºÍ·ÖÎö

WebÒ³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃASP.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´« ......

ASP.NET MVCÓëWebFormÇø±ð

[תÌùÒ»]
ʹÓÃASP.NET MVC¿ò¼Ü£¬´´½¨Ä¬ÈÏÏîÄ¿£¬µÚÒ»Ö±¹Û¸Ð¾õ¾ÍÊǵØÖ·¶¼ÊÇRewrite¹ýµÄ¡£¶ÔÔ´ÂëºÍÅäÖÃÎļþÉÔ¼Ó·ÖÎö²»ÄÑ¿´³ö£¬MVCʹÓÃÁËhttpModulesÀ´À¹½ØµØÖ·ÇëÇ󣬾ßÌåÓõ½ÁËSystem.Web.RoutingÀà¿â£¨MVC2ÖУ¬MVC1ÔõôÓõÄÍü¼ÇÁË¡££©¶øÕⲿ·ÖÀà¿â±»°ü×°ÔÚ.NET Framework3.5 SP1ÖУ¬MVC2ÐèÒªSP1Ö§³ÖÒ²¾ÍÀíËùµ±È»ÁË¡£SP1Ìṩµ ......

asp.netÅжÏÊäÈëÎÄ×ÖÊÇ·ñÊÇÊý×Ö (ת)

·½°¸Ò»:
/**//// <summary>
/// Ãû³Æ£ºIsNumberic
/// ¹¦ÄÜ£ºÅжÏÊäÈëµÄÊÇ·ñÊÇÊý×Ö
/// ²ÎÊý£ºstring oText£ºÔ´Îı¾
/// ·µ»ØÖµ£º¡¡bool true:ÊÇ¡¡false:·ñ
/// </summary>
public bool IsNumberic(string oText)
{
try
{
int var1=Convert.ToInt32 (oText);
return true;
}
catch ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ