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

asp.netÉú³É¾²Ì¬ÍøÒ³

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
namespace xmlDemo
{
/**//// <summary>
/// staticWeb µÄժҪ˵Ã÷¡£
/// </summary>
public class staticWeb : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// ÔÚ´Ë´¦·ÅÖÃÓû§´úÂëÒÔ³õʼ»¯Ò³Ãæ
}
public bool WriteFile(string strText,string strContent,string strAuthor)
{
string path = Server.MapPath("~/news/");
Encoding code = Encoding.GetEncoding("gb2312");
// ¶Áȡģ°åÎļþ
string temp = Server.MapPath("~/news/text.htm");
StreamReader sr=null;
StreamWriter sw=null;
string str="";
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd(); // ¶ÁÈ¡Îļþ
}
catch(Exception exp)
{
HttpContext.Current.Response.Write(exp.Message);
HttpContext.Current.Response.End();
sr.Close();
}
string htmlfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".htm";
// Ìæ»»ÄÚÈÝ
// Õâʱ,Ä£°åÎļþÒѾ­¶ÁÈëµ½Ãû³ÆÎªstrµÄ±äÁ¿ÖÐÁË
str =str.Replace("ShowArticle",strText); //Ä£°åÒ³ÖеÄShowArticle
str = str.Replace("biaoti",strText);
str = str.Replace("content",strContent);
str = str.Replace("author",strAuthor);
// дÎļþ
try
{
sw = new StreamWriter(path + htmlfilename , false, code);
sw.Write(str);
sw.Flush();
}
catch(Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
HttpContext.Current.Response.End();
}
finally
{
sw.Close();
}
return true;


Ïà¹ØÎĵµ£º

ASP.NET + CSSʵÏÖ¶¯Ì¬²Ëµ¥Í»³öÏÔʾµ±Ç°Ò³Ãæ

ÍøÉϹØÓÚÍ»³öÏÔʾµ±Ç°Ò³ÃæµÄÎÄÕÂÓв»ÉÙ£¬µ«ÊÇ»ù±¾¶¼ÊǹØÓÚʵÏÖ¾²Ì¬²Ëµ¥µÄ¸ßÁÁ£¬½²µ½¶¯Ì¬Éú³É²Ëµ¥¸ßÁÁµÄÎÄÕÂÖÁÉÙÎÒûÓÐÕÒµ½£¬ÔÚcsdnÉÏÎÊÁËÁ½Ì춼ûÓд𰸣¬×îºóÔÚһλÅóÓѵĻشðÖÐÕÒµ½Ë¼Â·£¬ÏÈÀûÓÃÒ»¸öº¯ÊýÅжϲ˵¥ÊÇ·ñÊÇÕýÔÚä¯ÀÀµÄµ±Ç°Ò³£¬È»ºó¸¶¸øliÒ»¸öid£¬ÀûÓÃcss²ãµþid´óÓÚclassµÄ¹ØÏµ£¬°ÑÕâ¸öid¶¨Òå³É¸ßÁÁÑùʽ¡£
aspx ......

Asp.net ÊÂÎñ´¦Àí

ÊÂÎñ´¦ÀíÊÇÔÚÊý¾Ý´¦Àíʱ¾­³£Óöµ½µÄÎÊÌ⣬¾­³£Óõ½µÄ·½·¨ÓÐÒÔÏÂ3ÖÖ×ܽáÕûÀíÈçÏ£º ·½·¨1£ºÖ±½ÓдÈëµ½sql ÖÐ ÔÚ´æ´¢¹ý³ÌÖÐʹÓà BEGIN TRANS, COMMIT TRANS, ROLLBACK TRANS ʵÏÖ  Óŵ㣺ÊÂÎñÂß¼­°üº¬ÔÚÒ»¸öµ¥¶ÀµÄµ÷ÓÃÖУ¬ÓÐÔËÐÐÒ»¸öÊÂÎñµÄ×î¼ÑÐÔÄÜ£¬Á¢ÓÚÓ¦ÓóÌÐò¡£ÏÞÖÆ£º ÊÂÎñÉÏÏÂÎĽö´æÔÚÓÚÊý¾Ý¿âµ÷ÓÃÖУ¬Êý¾Ý¿â´úÂëÓëÊ ......

ASP.net ʹÓÃÖ¤ÊéÈÏÖ¤

Ҫʹ ASP.NET Web Ó¦ÓóÌÐòÄܹ»Ê¹Óÿͻ§¶ËÖ¤Ê飬Äú±ØÐëÔÚ±¾µØ¼ÆËã»ú´æ´¢Öа²×°¿Í»§¶ËÖ¤Êé¡£Èç¹ûÄúÔÚ±¾µØ¼ÆËã»ú´æ´¢Öа²×°¿Í»§¶ËÖ¤Ê飬Ôò¸Ã¿Í»§¶ËÖ¤Êé½ö¶Ô¹ÜÀíÔ±×éÖеÄÓû§ÕÊ»§ºÍ°²×°¸Ã¿Í»§¶ËÖ¤ÊéµÄÓû§¿ÉÓá£Òò´Ë£¬Äú±ØÐëÏòÓÃÓÚÔËÐÐ ASP.NET Web Ó¦ÓóÌÐòµÄÓû§ÕÊ»§ÊÚȨ£¬Ê¹ÆäÄܹ»·ÃÎʿͻ§¶ËÖ¤Êé¡£
×¢Ò⣺±ØÐë°²×° Microso ......

ASP.NETÁ¬½ÓSQLºÍACCESSµÄ·½·¨

SQL:
using System.Data.SqlClient;
string sql = "server=.;uid=sa;pwd=;database=tablename;";
ACCESS:
using System.Data.OleDb;
string sql = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + HttpRuntime.AppDomainAppPath + "//App_Data//db.mdb";
HttpRuntime.AppDomainAppPath Ϊ¸ùĿ¼
......

asp.netµ¯³öÈ·¶¨»ò¾¯¸æ

ÔÚûÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³ÖУº
      Response.Write("<script>alert('¹§Ï²Äú£¬Òѳɹ¦¼ÓÈëµ½ÄúµÄÈ˲ſ⣡');</script>");
ÔÚÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³Ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ