edit.aspx
上传用户:scene123
上传日期:2010-02-19
资源大小:3311k
文件大小:2k
- <% @ Page Language="C#" %>
- <% @ Import Namespace="System.Data" %>
- <% @ Import Namespace="System.Data.OleDb" %>
- <Script Language="C#" Runat="Server">
- OleDbConnection MyConn;
- OleDbCommand com_edit;
- public String Fid1;
- public String Fid2;
- public string type;
- public string Body;
- public string Title;
- public string Id;
- public string sql_edit;
- public OleDbDataReader dr_edit;
- public void Page_Load(Object src,EventArgs e)
- {
- //得到数据
- Fid1=Request.QueryString["Fid1"];
- Fid2=Request.QueryString["Fid2"];
- Id=Request.QueryString["Id"];
- type=Request.QueryString["Type"];
- //连接数据库语句
- string MyConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath(".")+"..\DataBase\ld1.mdb;";
- MyConn = new OleDbConnection(MyConnString);
- MyConn.Open();
- if (type=="Reply"){
- sql_edit="select Title,Body,TopicId,id from "+Fid1+"Reply"+Fid2+" where id="+Id;
- }
- else {
- sql_edit="select Topic,Body,TopicId from "+Fid1+"Topic"+Fid2+" where TopicId="+Id;
- }
- OleDbCommand com_edit = new OleDbCommand(sql_edit,MyConn);
- dr_edit=com_edit.ExecuteReader();
- if (type=="Reply"){
- while(dr_edit.Read())
- {
- Title=dr_edit["Title"].ToString();
- Body=dr_edit["Body"].ToString();
- }
- dr_edit.Close();
- }
- else {
- while(dr_edit.Read())
- {
- Title=dr_edit["Topic"].ToString();
- Body=dr_edit["Body"].ToString();
- }
- dr_edit.Close();
- }
- MyConn.Close();
- }
- </script>
- <html>
- <head>
- <title>Untitled Document</title>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <link href="css/css.css" rel="stylesheet" type="text/css">
- </head>
- <BODY
- bgColor=#b7a173 leftMargin=0 topMargin=0 marginheight="10" marginwidth="10">
- <form name="form1" method="post" action="">
- <div align="center"><br>
- <br>
- 你编辑的帖子中可能含有html代码,如果你不熟悉;请不要修改。
- <br>
- <%=Title%>
- <br>
- <textarea name="textarea" cols="100" rows="10" class="unnamed2"><%=Body%></textarea>
- <br>
- <input name="Submit" type="submit" class="unnamed2" value="Submit">
- <input name="Submit2" type="reset" class="unnamed2" value="Reset">
- </div>
- </form>
- <p class="ziti"> </p>
- </body>
- </html>