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

ASP.NET Cache»º´æÏê½â

Àý×Ó£º
using system.web.caching
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E) {
DataView Source;
// Retrieve the DataView object from Cache. If not exist, then add DataView object to the Cache.
Source = (DataView)Cache["MyDataSet"];
if (Source == null) {
SqlConnection myConnection = new SqlConnection("Server=ServerName; database=Pubs; user id=UID; password=PWD;");
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Authors", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "Authors");
Source = new DataView(ds.Tables["Authors"]);
Cache["MyDataSet"] = Source;
CacheMsg.Text = "Dataset created explicitly";
}
else {
CacheMsg.Text = "Dataset retrieved from cache";
}
// Binding the DataView object with DataGrid.
MyDataGrid.DataSource=Source;
MyDataGrid.DataBind();
}
</script>
<body>
<form method="GET" runat="server">
<h3><font face="Verdana">Caching Data</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaad" />
<p>
<i><asp:label id="CacheMsg" runat="server"/></i>
</form>
</body>
</html>
ASP.NET CacheÊÇÌáÉýϵͳÐÔÄܵÄÖØÒª·½·¨£¬ËüʹÓÃÁË“×î½üʹÓÔԭÔò£¨a least-recently-used algorithm£©¡£ÔÚÊý¾Ý¿â·ÃÎÊÖо­³£»áÓõ½Cache±£´æÊý¾Ý¿âÊý¾Ý¡£ 1.»º´æµÄÌí¼Ó£ºCacheµÄÌí¼Ó·½·¨ÓÐAdd()»òInsert£¨£©£¬Á½ÖÖ·½·¨¼¸ºõÀàËÆ£¬Ö»ÊÇInser·½·¨¿ÉÒÔʹÓÿÉÑ¡²ÎÊý£¬¼´Ê¹ÓÃĬÈϲÎÊý£¬À´ÊµÏÖ»º´æµÄÌ


Ïà¹ØÎĵµ£º

Ò»¸ö¼òµ¥µÄASP.NET +ACCESS µÇ¼

Ê×Ò³£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......

ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂëʵÏÖ

´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.netÒ³ÃæÖеÄij¸öButton±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElem ......

asp.net ÖÐÈÕÆÚºÍʱ¼äµÄ¸ñʽ»¯

ÕâÒ²ÐíÊÇÒ»¸öСÎÊÌâ  µ«ÊÇÓкܶàѧÎÊ  ²»ÄÜÑÛ¸ßÊÖµÍ ÎҰѴ󲿷ÖÇé¿öÁгöÀ´ ¸ø´ó¼ÒÒ»¸öÌáÐÑ 
float str = 987654.32F;
//Response.Write(string.Format("{0:c}", str));
//this.Label1.Text = string.Format("{0:D}", str);
//this.Label1.Text = string.Format("{0:C}", str); ......

ASP.NET AjaxʵÏÖµ¯³öÌáʾ¿ò£¬Ò³Ãæ±ä»Ò²»¿Éµã»÷

×î½üÔÚÍøÉÏ¿´µ½Ò»ÆªÎÄÕ£¬½²ASP.NET ajaxÖеÄÒì³£´¦Àí£¬ÓÐÒ»²¿·ÖÊÇ×Ô¶¨Òåjavascript´¦ÀíÒì³£¡£Í»È»Ïëµ½ÍøÒ×ÓÊÏäÖУ¬µ¯³ö¶Ô»°¿ò£¬ºó±ßµÄÒ³Ãæ±ä»ÒÇÒ²»¿Éµã»÷µÄЧ¹û¡£
ÔÚÍøÉÏÕÒÁËһϣ¬ÊµÏÖ·½·¨¾ÍÊÇÓÃÁ½¸ö²ã£¬Ò»¸ö²ãÓÃÀ´ÏÔʾÌáʾÐÅÏ¢£¬Ò»¸ö²ãÓÃÀ´ÕÚ×¡Ò³Ãæ£»»¹ÓÐÒ»¸ö°ì·¨¾ÍÊÇÓÃiframe.Á½ÕߵIJ»Í¬Ö®´¦´ó¸Å¾ÍÔÚÓÚiframe¿ÉÒÔÕÚ×¡È ......

Asp.netÖÐcache¶ÔÏó¼ò½é

Asp.netÖ§³ÖÈýÖÖÀàÐ͵Äcache
Ïëдһ¸ö¼¼Êõ¿ìËÙ¸ÅÊö£¬¿ÉÄÜдµÃÌ«¶àÁË¡£¼¼Êõ¸ÅÂÔµÄÄ¿µÄÊÇÒÔ×î¿ì×î¼òµ¥µÄ·½Ê½ÃèÊö³ö¼¼ÊõÒªµã£¬Ò²ÊÇÎÒÏ£ÍûµÄ×îÓÐЧÂʵÄ֪ʶ´«²¥·½Ê½¡£
1£® Ò³Ãæ/¿Ø¼þcache
2£® Ó¦ÓóÌÐò¼¶cache
3£® ä¯ÀÀÆ÷¿Í»§¶Ëcache
´ÓʵÏÖ·½Ê½À´¿´£¬Ò³Ãæ/¿Ø¼þcacheºÍÓ¦ÓóÌÐò¼¶cache¶¼ÊÇ´æ·ÅÔÚ·þÎñÆ÷ÄÚ´æÀïÃæµÄ£¬Ëæ×ÅÄÚ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ