用ASP.NET做的博客系统

时间:2013-03-27 08:48:16
【文件属性】:

文件名称:用ASP.NET做的博客系统

文件大小:15KB

文件格式:RAR

更新时间:2013-03-27 08:48:16

能运行,很可以

用ASP.NET做的 using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; ///

/// Class1 的摘要说明 /// public class Class1 { private OleDbConnection m_Connection; private String m_brChar = "\n"; public Class1() { // // TODO: 在此处添加构造函数逻辑 // } private void ExecuteCommand(OleDbCommand cmd) { cmd.Connection=m_Connection; try { m_Connection.Open(); cmd.ExecuteNonQuery(); } finally { m_Connection.Close(); } } public DataSet GetNotes(DateTime fromDate, DateTime toDate) { DataSet ds=new DataSet(); OleDbDataAdapter da=new OleDbDataAdapter("select * from Notes where DateTime BETWEEN ? and ? ORDER BY DateTime DESC",m_Connection); da.SelectCommand.Parameters.Add("FromDate", OleDbType.Date).Value = fromDate.AddDays(1); m_Connection.Open(); da.Fill(ds,"MyNotes"); m_Connection.Close(); return ds; } public void InsertNote(string title,string contents) { OleDbCommand cmd =new OleDbCommand ("insert into Notes(Title,Contents) values(?,?)"); cmd.Parameters .Add ("Title",OleDbType .VarChar ).Value =title ; cmd.Parameters .Add ("Contents",OleDbType .LongVarChar ).Value =contents.Replace (m_brChar ,"
"); ExecuteCommand (cmd); } public void InsertComment(int noteid,string author,string email,string comment) { OleDbCommand cmd=new OleDbCommand ("insert into Comments(NoteID,Author,Email,Comment) values(?,?,?,?)"); cmd.Parameters .Add ("NoteID",OleDbType .VarChar ).Value =noteid; cmd.Parameters .Add ("Author",OleDbType .VarChar ).Value =author ; cmd.Parameters .Add ("Email",OleDbType .VarChar ).Value =email ; cmd.Parameters .Add ("Comment",OleDbType .LongVarChar ).Value =comment.Replace (m_brChar ,"
"); ExecuteCommand (cmd); } public void UpdaeNote(int noteid, string title, string contents) { OleDbCommand cmd = new OleDbCommand("UPDATE [Notes] SET [Title]=?,[Contents]=? WHERE [NoteID]=?"); cmd.Parameters.Add("Title", OleDbType.VarChar).Value = title; cmd.Parameters.Add("Contents", OleDbType.LongVarChar).Value = contents.Replace(m_brChar, "
"); cmd.Parameters.Add("NoteID", OleDbType.Integer).Value = noteid; ExecuteCommand(cmd); } public void UpdateComment(int commentid,string author,string email,string comment) { OleDbCommand cmd =new OleDbCommand ("UPDATE Comments SET Author =?,Email=?,Comment=? WHERE CommentID=?"); cmd.Parameters .Add ("Author",OleDbType .VarChar ).Value =author; cmd.Parameters .Add ("Comment",OleDbType .LongVarChar).Value =comment.Replace (m_brChar ,"
"); cmd.Parameters.Add("Email", OleDbType.VarChar).Value = email; cmd.Parameters.Add("CommentID", OleDbType.VarChar).Value = commentid; ExecuteCommand(cmd); } public void DeleteNote(int noteid) { OleDbCommand cmd =new OleDbCommand ("delete from Notes where NoteID="+noteid); ExecuteCommand(cmd); } public void DeleteComment(int commentid) { OleDbCommand cmd =new OleDbCommand ("delete from Comments where CommentID="+commentid); ExecuteCommand (cmd); } public void GetNoteData(int noteid,ref string title,ref string contents,ref string post_time) { OleDbCommand cmd=new OleDbCommand ("select * from Notes where NoteID="+ noteid ,m_Connection ); try { m_Connection .Open(); OleDbDataReader reader=cmd.ExecuteReader (CommandBehavior .CloseConnection ); if(reader .Read ()) { title =reader ["Title"].ToString (); contents =reader ["Contents"].ToString ().Replace ("
",m_brChar ); post_time =reader ["DataTime"].ToString (); reader .Close (); } } finally { m_Connection .Close (); } } public void GetCommentData(int commentid,ref string author,ref string email,ref string comment) { OleDbCommand cmd=new OleDbCommand ("select * from Comments where CommentID="+commentid ,m_Connection ); try { m_Connection .Open (); OleDbDataReader reader=cmd.ExecuteReader (CommandBehavior .CloseConnection ); if(reader.Read ()) { author =reader ["Author"].ToString (); email =reader ["Comment"].ToString ().Replace ("
",m_brChar ); reader .Close (); } } finally { m_Connection .Close (); } } } /// /// data 的摘要说明 ///


【文件预览】:
blog
----firstfm.aspx.cs(409B)
----App_Code()
--------Class1.cs(5KB)
----lgin.aspx(1KB)
----lgin.aspx.cs(867B)
----Web.config(2KB)
----WebUserControl.ascx.cs(422B)
----Default2.aspx(561B)
----App_Data()
--------blog.mdb(188KB)
----Default.aspx(445B)
----Default.aspx.cs(396B)
----Default2.aspx.cs(409B)
----WebUserControl.ascx(882B)
----firstfm.aspx(599B)

网友评论

  • 系统做得不错
  • 有点简单啊。
  • 太简单了吧...基本没有技术含量呀
  • 还可以,可以借鉴
  • 为什么我下载后运行出错啊 错误 “ ASP.firstfm_aspx”并不包含“ucfooter_Load”的定义
  • 系统做得不错