| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 774 人关注过本帖
标题:论坛代码
只看楼主 加入收藏
ecp2008
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-3-16
收藏
 问题点数:0 回复次数:5 
论坛代码

小弟急需商城和论坛的源代码,有谁可以给个好点的地址呀?
网上的那些好象都不太好用,总是链接方面出现问题。谢谢各位了。

搜索更多相关主题的帖子: 代码 
2006-03-16 15:34
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 

我给一点代码,你自己看看,index.aspx
<%@ Page Language="vb" Debug="True" %>
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<html>
<head><title>BBS</title>
</head>
<body bgcolor="#FFFFFF">
<h2 align="center">讨论板</h2>
<form runat="server">
<asp:DataGrid runat="server" ID="MyGrid"
AllowPaging="true"
PageSize="10"
OnPageIndexChanged="ChangePage"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right"
AlternatingItemStyle-BackColor="#FFFFCC"
GridLines="None"
border="1"
CellSpacing="0"
CellPadding="2"
AutoGenerateColumns="false"
width="100%"
>
<columns>
<asp:BoundColumn DataField="TITLES_DATE" HeaderText="日期" />
<asp:BoundColumn DataField="TITLES_NAME" HeaderText="作者" />
<asp:BoundColumn DataField="TITLES_NUM" HeaderText="则数" />
<asp:HyperLinkColumn DataTextField="TITLES_SUBJECT"
HeaderText="主题"
DataNavigateUrlField="TITLES_ID"
DataNavigateUrlFormatString="Detail.aspx?TITLES_ID={0}" />
</columns>
</asp:DataGrid>
<table width="100%" height="192" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td colspan="2">发起讨论主题</td>
</tr>
<tr>
<td width="31%" align="right">姓名:</td>
<td width="69%">
<asp:TextBox runat="server" ID="TITLES_NAME" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="TITLES_NAME" /></td>
</tr>
<tr>
<td align="right">EMAIL:</td>
<td>
<asp:TextBox runat="server" ID="TITLES_EMAIL" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="TITLES_EMAIL" />
<asp:RegularExpressionValidator runat="server" ControlToValidate="TITLES_EMAIL" Text="EMAIL要符合规范"
ValidationExpression=".{1,}@.{3,}" Display="Dynamic" />

</td>
</tr>
<tr>
<td align="right">主题:</td>
<td><asp:TextBox runat="server" ID="TITLES_SUBJECT" Size="60" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="TITLES_SUBJECT" />
</td>
</tr>
<tr>
<td align="right">内容:</td>
<td><asp:TextBox ID="TITLES_CONTENT" runat="server" Rows="6" Columns="60" TextMode="MultiLine" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="TITLES_CONTENT" />
</td>
</tr>
<tr align="center">
<td colspan="2"><asp:Button ID="Button" Text="发表主题" runat="server" OnClick="Send_Click" /></td>
</tr>
</table>
</form>
</body>
</html>

<script language="vb" runat="server">
Dim Provider = "Provider=Microsoft.Jet.OLEDB.4.0"
Dim DataBase = "Data Source=" & Server.MapPath( "data/)#data.mdb" )

Sub Page_Load(send As Object, E As EventArgs)
If Not IsPostBack Then
OpenDataBase_And_BindToDataGrid()
End If
End Sub

Sub ChangePage(sender As Object, E As DataGridPageChangedEventArgs)
MyGrid.CurrentPageIndex = E.NewPageIndex
OpenDataBase_And_BindToDataGrid()
End Sub

Sub OpenDataBase_And_BindToDataGrid()
Dim Conn As OleDbConnection, Adpt As OleDbDataAdapter
Dim Ds As DataSet, SQL As String, I As Integer
Dim Table1 As DataTable
Conn = New OleDbConnection( Provider & ";" & DataBase )
Conn.Open()

SQL = "Select * From BBS_TITLES Order By Titles_LASTPOSTDATE Desc"
Adpt = New OleDbDataAdapter( SQL, Conn )
Ds = New DataSet()
Adpt.Fill(Ds, "BBS_TITLES")
Table1 = Ds.Tables( "BBS_TITLES" )
Table1.Columns.Add(New DataColumn("TITLES_DATE", GetType(String)))
For I = 0 To Table1.Rows.Count-1
Dim D1 As Date = Table1.Rows(I).Item("TITLES_CREATEDATE")
Dim D2 As Date = Table1.Rows(I).Item("TITLES_LASTPOSTDATE")
Table1.Rows(I).Item("TITLES_DATE") = Format( D1, "MM/dd") & "-" & Format( D2, "MM/dd")
Next

MyGrid.DataSource = Table1.DefaultView
MyGrid.DataBind()

Conn.Close()

End Sub

Sub Send_Click(sender As Object, E As EventArgs)
Dim Conn As OleDbConnection,Cmd As OleDbCommand
Dim SQL As String
Conn = New OleDbConnection( Provider & ";" & DataBase )
Conn.Open()

SQL = "Insert Into BBS_TITLES (TITLES_NAME, TITLES_EMAIL, TITLES_SUBJECT, TITLES_CONTENT, TITLES_NUM) Values (?, ?, ?, ?, ?)"
Cmd = New OleDbCommand(SQL, Conn)
Cmd.Parameters.Add( New OleDbParameter("TITLES_NAME", OleDbType.Char,255))
Cmd.Parameters.Add( New OleDbParameter("TITLES_EMAIL", OleDbType.Char,255))
Cmd.Parameters.Add( New OleDbParameter("TITLES_SUBJECT", OleDbType.VarChar))
Cmd.Parameters.Add( New OleDbParameter("TITLES_CONTENT", OleDbType.VarChar))
Cmd.Parameters.Add( New OleDbParameter("TITLES_NUM", OleDbType.Integer))

Cmd.Parameters("TITLES_NAME").Value = TITLES_NAME.Text
Cmd.Parameters("TITLES_EMAIL").Value = TITLES_EMAIL.Text
Cmd.Parameters("TITLES_SUBJECT").Value = TITLES_SUBJECT.Text
Cmd.Parameters("TITLES_CONTENT").Value = TITLES_CONTENT.Text
Cmd.Parameters("TITLES_NUM").Value = 0

Cmd.ExecuteNonQuery()
Conn.Close()

OpenDataBase_And_BindToDataGrid()

End Sub
</script>


让我们风风火火的过一生,别平平淡淡过一年。
2006-03-16 15:54
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 

第二个页:datail.aspx
<%@ Page Language="vb" Debug="true" %>
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>讨论</title>
</head>
<body>
<h2 align="center">讨论看板</h2>
<a href="index.aspx">讨论首页</a>
<form runat="server">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="center" bgcolor="#CCCCCC">讨论主题</td>
</tr>
</table>

<asp:Repeater runat="server" ID="Repeater1">
<itemtemplate>
<table width="100%" height="154" border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="24">作者:<%# Container.DataItem("TITLES_NAME") %>&nbsp;
EMAIL:<%# Container.DataItem("TITLES_EMAIL") %>&nbsp;
日期:<%# Container.DataItem("TITLES_CREATEDATE") %></td>
</tr>
<tr>
<td height="23">主题:<%# Server.HtmlEncode(Container.DataItem("TITLES_SUBJECT")) %></td>
</tr>
<tr>
<td height="107"><%# Server.HtmlEncode(Container.DataItem("TITLES_CONTENT")) %></td>
</tr>
</table>
</itemtemplate>
</asp:Repeater>

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="center" bgcolor="#CCFFCC">讨论看板</td>
</tr>
</table>

<asp:DataList runat="server" ID="DataList1" width="100%">
<itemtemplate>
<table width="100%" height="154" border="1" cellpadding="0" cellspacing="0">
<tr>
<td height="24">作者:<%# Container.DataItem("DETAILS_NAME") %>&nbsp;
EMAIL:<%# Container.DataItem("DETAILS_EMAIL") %>&nbsp;
日期:<%# Container.DataItem("DETAILS_CREATEDATE") %></td>
</tr>
<tr>
<td height="23">主题:<%# Server.HtmlEncode(Container.DataItem("DETAILS_SUBJECT")) %></td>
</tr>
<tr>
<td height="107"><%# Server.HtmlEncode(Container.DataItem("DETAILS_CONTENT")) %></td>
</tr>
</table>
</itemtemplate>
</asp:DataList>

<table width="100%" height="192" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td colspan="2">回复讨论主题</td>
</tr>
<tr>
<td width="31%" align="right">姓名:</td>
<td width="69%">
<asp:TextBox runat="server" ID="DETAILS_NAME" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="DETAILS_NAME" /></td>
</tr>
<tr>
<td align="right">EMAIL:</td>
<td>
<asp:TextBox runat="server" ID="DETAILS_EMAIL" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="DETAILS_EMAIL" />
<asp:RegularExpressionValidator runat="server" ControlToValidate="DETAILS_EMAIL" Text="EMAIL要符合规范"
ValidationExpression=".{1,}@.{3,}" Display="Dynamic" />

</td>
</tr>
<tr>
<td align="right">主题:</td>
<td><asp:TextBox runat="server" ID="DETAILS_SUBJECT" Size="60" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="DETAILS_SUBJECT" />
</td>
</tr>
<tr>
<td align="right">内容:</td>
<td><asp:TextBox ID="DETAILS_CONTENT" runat="server" Rows="6" Columns="60" TextMode="MultiLine" />
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="DETAILS_CONTENT" />
</td>
</tr>
<tr align="center">
<td colspan="2"><asp:Button ID="Button" Text="发表主题" runat="server" OnClick="Send_Click" /></td>
</tr>
</table>

</form>
</body>
</html>

<script language="vb" runat="server">
Dim Provider = "Provider=Microsoft.Jet.OLEDB.4.0"
Dim DataBase = "Data Source=" & Server.MapPath( "data/)#data.mdb" )

Sub Page_Load(send As Object, E As EventArgs)
If Not IsPostBack Then
OpenDataBase_And_BindToDataGrid()
End If
End Sub

Sub OpenDataBase_And_BindToDataGrid()
Dim TITLES_ID As Integer = Val(Request("TITLES_ID"))
Dim Conn As OleDbConnection, SQL As String
Dim Adpt As OleDbDataAdapter, Adpt2 As OleDbDataAdapter
Dim Ds As DataSet,Ds2 As DataSet
Conn = New OleDbConnection( Provider & ";" & DataBase )
Conn.Open()

SQL = "Select * From BBS_TITLES Where TITLES_ID=" & TITLES_ID
ADPT = New OleDbDataAdapter( SQL, Conn )
Ds = New DataSet()
Adpt.Fill(Ds, "BBS_TITLES")
Repeater1.DataSource = Ds.Tables( "BBS_TITLES" ).DefaultView
Repeater1.DataBind()

SQL = "Select * From BBS_DETAILS Where TITLES_ID=" & TITLES_ID & _
" Order By DETAILS_ID Desc"
Adpt2 = New OleDbDataAdapter( SQL, Conn )
Ds = New Dataset()
Adpt2.Fill(Ds, "BBS_DETAILS")
DataList1.DataSource = Ds.Tables( "BBS_DETAILS" ).DefaultView
DataList1.DataBind()

End Sub

Sub Send_Click(sender As Object, E As EventArgs)
Dim Conn As OleDbConnection, Cmd As OleDbCommand
Dim SQL As String
Dim TITLES_ID As Integer = Val(Request("TITLES_ID"))

Conn = New OleDbConnection( Provider & ";" & DataBase )
Conn.Open()

SQL = "Insert Into BBS_DETAILS (DETAILS_NAME, DETAILS_EMAIL, DETAILS_SUBJECT, DETAILS_CONTENT, TITLES_ID)Values (?, ?, ?, ?, ?)"
Cmd = New OleDbCommand( SQL, Conn )
Cmd.Parameters.Add( New OleDbParameter("DETAILS_NAME",OleDbType.Char,255))
Cmd.parameters.Add( New OleDbParameter("DETAILS_EMAIL",OleDbType.Char,255))
Cmd.Parameters.Add( New OleDbParameter("DETAILS_SUBJECT",OleDbType.VarChar))
Cmd.Parameters.Add( New OleDbParameter("DETAILS_CONTENT",OleDbType.VarChar))
Cmd.Parameters.Add( New OleDbParameter("TITLES_ID",OleDbType.Integer))

Cmd.Parameters(0).Value = DETAILS_NAME.Text
Cmd.Parameters(1).Value = DETAILS_EMAIL.Text
Cmd.Parameters(2).Value = DETAILS_SUBJECT.Text
Cmd.Parameters(3).Value = DETAILS_CONTENT.Text
Cmd.Parameters(4).Value = TITLES_ID

Cmd.ExecuteNonQuery()

SQL = "Update BBS_TITLES Set TITLES_LASTPOSTDATE=Now(),TITLES_NUM=TITLES_NUM+1 Where TITLES_ID="&TITLES_ID
Cmd = New OleDbCommand( SQL, Conn )
Cmd.ExecuteNonQuery()
Conn.Close()

OpenDataBase_And_BindToDataGrid()

End Sub


</script>


让我们风风火火的过一生,别平平淡淡过一年。
2006-03-16 15:55
water123456
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:3208
专家分:5
注 册:2006-2-21
收藏
得分:0 

数据库你自己建立吧,这一点,没有什么的,但是对你学习。NET很有用的。


让我们风风火火的过一生,别平平淡淡过一年。
2006-03-16 15:56
ecp2008
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-3-16
收藏
得分:0 

谢谢了

2006-03-17 11:38
银月
Rank: 1
等 级:新手上路
帖 子:127
专家分:0
注 册:2005-1-2
收藏
得分:0 

呵呵!


2006-05-22 13:59
快速回复:论坛代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016386 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved