asp.net³ÌÐòExcelת³ÉXMLµµ
ͨ¹ýAsp.net(C#)Ó¦ÓóÌÐò¶ÁÈ¡±¾µØÉÏ´«µÄExcleÎļþ,´æ·Åµ½DataSetÖÐ,ͨ¹ýDataSetÖеķ½·¨Ö±½ÓÉú³ÉXMLÎļþ.
C# Code
if (this.FileUpload1.PostedFile != null)
{
string filename = this.FileUpload1.FileName.ToString();
string path = @Server.MapPath("../File/") + filename;
this.FileUpload1.PostedFile.SaveAs(path);
//¶ÁÈ¡Óû§ÉÏ´«µÄExcleÎļþ
string conn="Provider = Microsoft.Jet.OLEDB.4.0 ;Data Source ='"+path+"';Extended Properties=Excel 8.0";
OleDbConnection olecon = new OleDbConnection(conn);
olecon.Open();
//×¢Òâ±íÃû,´ò¿ªExcelÎļþºó,×îµ×²¿·ÖÒ³µÄExcleÃû×Ö,
//ĬÈÏÊÇ$Sheet1,$Sheet2,$Sheet3
string sql = "select * from [$Sheet1]";
OleDbDataAdapter oleda = new OleDbDataAdapter(sql,conn);
oleda.Fill(ds);
olecon.Close();
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
string file_name = "20091126002.xml";
&nb
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
ÔÚGlobal.asaxÆô¶¯Ò»ÌõÏ߳̾ÍokÁË£¬ÏÂÃæÊÇÆô¶¯Ï̶߳¨Ê±Ð´ÎļþµÄÀý×Ó
¡¡¡¡Global.asax
¡¡¡¡C# code
¡¡¡¡Code
¡¡¡¡1<%@ Application Language="C#" %>
¡¡¡¡2<%@ Import Namespace="System.IO" %>
¡¡¡¡3<%@ Import Namespace="System.Threading" %>
¡¡¡¡4<script runat="server">
¡¡¡¡5 ......
ͨ¹ý SqlDataSource ¿Ø¼þ£¬¿ÉÒÔʹÓà Web ·þÎñÆ÷¿Ø¼þ·ÃÎÊλÓÚ¹ØϵÊý¾Ý¿âÖеÄÊý¾Ý¡£ÆäÖпÉÒÔ°üÀ¨ Microsoft SQL Server ºÍ Oracle Êý¾Ý¿âÒÔ¼° OLE DB ºÍ ODBC Êý¾ÝÔ´¡£Äú¿ÉÒÔ½« SqlDataSource ¿Ø¼þÓëÊý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢FormView ºÍ DetailsView ¿Ø¼þ£©Ò»ÆðʹÓã¬Óü«ÉÙ´úÂë»òÉõÖÁ² ......
1. BinÎļþ¼Ð
BinÎļþ¼Ð°üº¬Ó¦ÓóÌÐòËùÐèµÄ£¬ÓÃÓڿؼþ¡¢×é¼þ»òÕßÐèÒªÒýÓõÄÈκÎÆäËû´úÂëµÄ¿É²¿Êð³ÌÐò¼¯¡£¸ÃĿ¼ÖдæÔÚµÄÈκÎ.dllÎÄ ¼þ½«×Ô¶¯µØÁ´½Óµ½Ó¦ÓóÌÐò¡£
2. App_BrowserÎļþ¼Ð
¸Ã¿ÉÑ¡µÄÎļþ¼Ð°üº¬.browserÎļþ¡£.browserÎļþÃèÊöä¯ÀÀÆ÷(²»¹ÜÊÇÒƶ¯É豸ä¯ÀÀÆ÷£¬»¹ÊÇ̨ʽ»úä¯ÀÀÆ÷)µÄÌØ Õ÷ºÍ¹¦ÄÜ¡£
3. ......
////½ñÌìÔÚÐ޸ijÌÐòµÄʱºò·¢ÏÖÒ»¸öСµÄÎÊÌâÌؼǼÈçÏÂ:
//////ÓÐʱºòdatetimeÎÞ·¨×ª³Éstring£¬¿ÉÒÔÓÃgetdate()Ö±½Ó²åÈë¾Í¿ÉÒÔÁË
string str = "update adaddress set shenhe=" + ck + " ,shentime=getDate() where id=" + uid + "";
/////////////////////////////////////////
ÒÔϾßÌå½éÉÜÈÕÆÚÔõÑùת»»
DateTime.Now ......