asp.net ʵÏÖexcelµ¼Èëµ½Êý¾Ý¿â
//ExcelÅúÁ¿µ¼Èëµ½Êý¾Ý¿â
protected void btnUpload_Click(object sender, EventArgs e)
{
string IsXls = System.IO.Path.GetExtension(UploadExcel.FileName.ToString().ToLower());
if (IsXls != ".xls")
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script type='text/javascript' language='javascript'>alert('Ö»¿ÉÒÔÑ¡ÔñExcelÎļþ');location.href='EmployeeAddPage.aspx';</script>");
return;//µ±Ñ¡ÔñµÄ²»ÊÇExcelÎļþʱ,·µ»Ø
}
string filePath = UploadExcel.PostedFile.FileName;
string fileName = UploadExcel.FileName;
DataSet ds = ExecleDs (filePath,fileName);
CommonLayer.employeeModel model = new CommonLayer.employeeModel();
DataAcessLayer.employee_infomation addlist = new DataAcessLayer.employee_infomation();
if (ds.Tables[0].Rows.Count > 0)
{
int row = ds.Tables[0].Rows.Count-1;
for (int i = 0; i < ds.Tables[0].Select().Length; i++)
{
&
Ïà¹ØÎĵµ£º
ÎÊ£ºÎªÊ²Ã´SessionÔÚÓÐЩ»úÆ÷ÉÏż¶û»á¶ªÊ§£¿
´ð£º¿ÉÄܺͻúÆ÷µÄ»·¾³ÓйØϵ£¬±ÈÈ磺·À»ðǽ»òÕßɱ¶¾Èí¼þµÈ£¬³¢ÊԹرշÀ»ðǽ¡£
ÎÊ£ºÎªÊ²Ã´µ±µ÷ÓÃSession.Abandonʱ²¢Ã»Óм¤·¢Session_End·½·¨£¿
´ð£ºÊ×ÏÈSession_End·½·¨Ö»Ö§³ÖInProc£¨½ø³ÌÄڵģ©ÀàÐ͵ÄSession¡£Æä´ÎÒª¼¤·¢Session_End·½·¨£¬±ØÐë´æÔÚSession£¨¼´ÏµÍ³ÖÐÒÑ¾Ê¹Ó ......
µ¼³öµ½excelµÄ·½·¨ÓжàÖÖ£¬±È½Ï³£¼ûµÄÊÇÖ±½Óµ¼³öµ½EXCEL,»¹ÓоÍÊÇÏȽ«Ò³ÃæµÄÊý¾Ýдµ½´ÅÅÌÎļþ£¬Ö®ºóÖ±½ÓÔÙ´ò¿ªÎļþ£¬ÁíÍ⻹ÓоÍ
ÊǽèÖúµÚÈý·½µÄ¿Ø¼þ¡£
Ç°¶Îʱ¼äдµÄµ¼³öÊý¾Ýµ½excelÔÚexcel2003ÖÐÕý³£¶øÔÚexcel2007ÖÐÊý¾ÝÂÒÂ룬½ñÌìÁ˽⵽ÔÀ´ÊÇResponse.ContentType = "application/ms-excel";µ¼Ö ......
н¨Ò»¸öרÃÅÓÃÀ´´´½¨ÑéÖ¤ÂëͼƬµÄÒ³ÃæValidateCode.aspx
ËüµÄºǫ́csÎļþ´úÂëÈçÏ£º
PageLoad
private void Page_Load(object sender, System.EventArgs e)
{
string checkCode = CreateRandomCode(4);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
......
1 ʹÓñê×¼HTMLÀ´½øÐÐͼƬÉÏ´«
ǰ̨´úÂ룺
<body>
<form id="form1" runat="server">
<div>
<table>
&nbs ......
asp.netÉú³É¾²Ì¬Ò³Ãæͨ³£»áÓÐ2Öз½Ê½£¬Ò»ÖÖÊÇα¾²Ì¬£¬Ò»ÖÖÊÇÊÂÏÈдºÃÄ£°åÈ»ºóÖ±½ÓÌæ»»ÄÚÈÝ¡£¶ÔÓÚ2ÖÖ·½Ê½µÄÓÅȱµã£¬Ôڴ˲»ÌÖÂÛ£¬ÖصãÊÇ˵ϵڶþÖÖ·½Ê½£¬ÔÚÉú³É¾²Ì¬Ò³ÃæÖÐÓÐһЩÐÅÏ¢ÐèҪʵʱ´ÓÊý¾Ý¿â¶ÁÈ¡£¨±ÈÈ磺ÔÚÐÂÎÅÒ³Ã棬ÎÒÃÇ»áÐèҪһЩÈȵãÅÅÐУ¬ÕâЩÈȵãÐÂÎÅÎÒÃǾÍÐèҪʵʱµÄ´ÓÊý¾Ý¿âÀï±ßÄõ½£©¡£
......