Myconn.cs
Namespace Notpage
{
Using System;
Using System.Data.SQL;</p><p>//<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 = "";
}
}
}
Add Message addtopic.aspx
<%@ page language= "C #" codebehind= "AddTopic.cs" autoeventwireup= "false" inherits= "notpage. Addtopic "%>
<meta content= "Microsoft Visual Studio 7.0" name=generator>
<meta content=c# name=code_language><body>
<form method=post runat= "Server" >
<table cellspacing=1 cellpadding=1 width= "88%" border=0>
<tr>
<td> Message Theme:</td>
<td><asp:textbox id=txttitle runat= "Server" maxlength= "columns=" ></asp:textbox></td ></TR>
<tr>
<td> name:</td>
<td><asp:textbox id=txtauthor runat= "Server" maxlength= "+" columns= "></asp:textbox></td" ></TR>
<tr>
<td> Message Content </TD>
<td><asp:textbox id=txtcontent runat= "Server" maxlength= "$" columns= "rows=" "textmode=" ></asp:textbox><asp:button
Id=btnsubmit runat= "Server"
text= "Confirm" ></asp:button></TD></TR></TABLE></FORM>
</body> 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;</p><p>///<summary>
//Summary description for Addtopic.
</summary>
public class AddTopic:System.Web.UI.Page
{
Protected System.Web.UI.WebControls.TextBox txtcontent;
protected System.Web.UI.WebControls.TextBox Txtauthor;
protected System.Web.UI.WebControls.TextBox Txttitle;
protected System.Web.UI.WebControls.Button btnsubmit;
Public Addtopic ()
{
Page.Init + = new System.EventHandler (Page_Init);
}</p><p> protected void Page_Load (object sender, EventArgs e)
{
if (! IsPostBack)
{
//
Evals true first time browser hits the page
//
}
}</p><p> protected void Page_Init (object sender, EventArgs e)
{
//
Codegen:this call was required by the asp+ Windows Form Designer.
//
InitializeComponent ();
}</p><p>//<summary>
Required method for Designer support-do not modify
The contents of this method with the Code editor.
</summary>
private void InitializeComponent ()
{
Btnsubmit.click + = new System.EventHandler (this. OnSubmit);
This. Load + = new System.EventHandler (this. Page_Load);
}
public void OnSubmit (Object sender, EventArgs e)
{
if (Page.IsValid)
{
Data warehousing
Try
{
Notepage OBJNP = new Notepage ();
Objnp.title = Txttitle.text;
Objnp.author = Txtauthor.text;
Objnp.content = Txtcontent.text;
Objnp.adddate = System.DateTime.Now;
Notepage objNp1 = new Notepage ();
if (Objnp1.addtopic (OBJNP))
{
Response.Write ("<p align=center class=cn> Success Message, click <a href = list.aspx> here </a> view message list!. </p> ");
}
}
catch (Exception exp)
{
#if DEBUG
Response.Write ("Exception occurred:" + exp.) Message);
return;
#endif//debug
}
}
}</p><p>}
}
The above is the use of C # to make a simple message board (2) of the content, more relevant articles please pay attention to topic.alibabacloud.com (www.php.cn)!