detail.aspx

来自「Asp.net实用案例教程」· ASPX 代码 · 共 65 行

ASPX
65
字号
<%@ page language="C#"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<Html><Body BgColor="White">
<script runat="server">

    // Insert page code here
    //
    
    void Button1_Click(Object sender, EventArgs e) {
  
    //设置连接字符串
   OleDbConnection Conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+
                    "Data Source="+Server.MapPath("../db/workflow.mdb"));
   // 打开连接
   Conn.Open();
   // 构造SQL语句,该语句用于往Customers表中插入一条记录
   String strSQL="Update workstep set scomment='"+TextBox1.Text+"' where wname='"+Request["id"]+"' and srole='"+Session["username"]+"'";
   // 创建Command对象
   OleDbCommand Comm=new OleDbCommand(strSQL,Conn);
   // 执行ExecuteNonQuery()方法
   Comm.ExecuteNonQuery();   
   // 关闭连接
   Conn.Close();
   Response.Write("操作成功!");
    }

</script>

<%
  OleDbConnection Conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+
                    "Data Source="+Server.MapPath("../db/workflow.mdb"));
   Conn.Open();
   String strSQL="select * from workflow where wname='"+Request["id"]+"'";
   OleDbCommand Comm=new OleDbCommand(strSQL,Conn);
   // 执行ExecuteReader()方法  
   OleDbDataReader dr=Comm.ExecuteReader();

   string html=" ";

  while(dr.Read()) 
  {
  html+="<TR>";
  html+="<td>工作名称:</td><TD>" +  dr["wname"].ToString() + "<br></TD>";
  html+="<td>工作内容:</td><TD>" +  dr["wcontent"].ToString() + "<br></TD>";
  html+="</TR>";
  }
 
Response.Write(html);

%>
    <form runat="server">
        <p>
            <asp:Label id="Label1" runat="server">你的意见</asp:Label>
            <asp:TextBox id="TextBox1" runat="server" TextMode="MultiLine" Height="97px" Width="215px"></asp:TextBox>
        </p>
        <p>
            <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="完毕"></asp:Button>
        </p>
        <p>
        </p>
        <!-- Insert content here -->
    </form>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?