日期:2013-01-07  浏览次数:20408 次

myconn.cs
namespace notpage
{
    using System;
    using System.Data.SQL ;

    /// <summary>
    ///    Summary description for myconn.
    /// </summary>
    public class myconn:System.Data.SQL.SQLConnection
    {
        private void InitializeComponent ()
        {
        }
    
        public myconn()
        {
            //
            // TODO: Add Constructor Logic here
            //
            this.Database = "back" ;
            this.DataSource = "LUOCHANG" ;
            this.UserID = "sa" ;
            this.Password = "" ;
        }
    }
}
添加留言addTopic.aspx
<%@ Page language="c#" Codebehind="AddTopic.cs" AutoEventWireup="false" Inherits="notpage.AddTopic" %>
<html><head>
<meta content="Microsoft Visual Studio 7.0" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE></head>
<body>
<form method=post runat="server">
<table cellSpacing=1 cellPadding=1 width="88%" border=0>
  <tr>
    <td>留言主题:</TD>
    <td><asp:textbox id=txtTitle runat="server" maxlength="80" columns="65"></asp:textbox></TD></TR>
  <tr>
    <td>姓名:</TD>
    <td><asp:textbox id=txtAuthor runat="server" maxlength="40" columns="20"></asp:textbox></TD></TR>
  <tr>
    <td>留言内容</TD>
    <td><asp:textbox id=txtContent runat="server" maxlength="2000" columns="50" rows="20" TextMode="MultiLine"></asp:textbox><asp:button
      id=btnSubmit runat="Server"
  text="确认"></asp:button></TD></TR></TABLE></FORM>
    
  </body></html>

对应的cs
namespace notpage
{
    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;

    /// <summary>
    ///    Summary description for AddTopic.
    /// </summary>
    public class AddTop