文件名称:用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;
///
");
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 ();
}
}
}
///
【文件预览】:
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)