ASP.NET

Computer forum-Message page code

Message.aspx

<%@ Page Language="vb" AutoEventWireup="true" %>
<%@ Import Namespace ="System.Data" %>
<%@ Import Namespace ="System.Data.Oledb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Message</title>
<style type="text/css">
#form1
{
height: 212px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h4 style="background-color: #CCCFFF">Question:</h4>
<p>
<asp:TextBox ID="txtq" TextMode="MultiLine" runat ="server" Height="214px" Width="600px" />
</p>
</div>
<asp:Button ID="Submit" runat="server" Text="Add a Reply to this Question"
Width="194px" OnClick="Addreply"/>
<asp:Button ID="bntanswer" runat="server" Text="View Answers" Width="148px" OnClick="viewanswer" />
</form>
</body>
</html>

<script runat="server">

Dim cn As OleDb.OleDbConnection

Dim ds As New DataSet

Dim ad As OleDb.OleDbDataAdapter

Sub Page_Load

If Not Page.IsPostBack Then

show()

End If

End Sub

Sub show(ByVal sender As Object, ByVal e As System.EventArgs)

cn = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & MapPath("dbthreads.accdb"))

cn.Open()

ad = New OleDb.OleDbDataAdapter("Select * From tblthread Where threadid=" & CInt(Request.QueryString("threadid")), cn)

ad.Fill(ds, "tblthread")

txtq.Text = ds.Tables(0).Rows(0)(4).ToString()

cn.Close()

End Sub

Sub Addreply(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("Reply.aspx?threadid=" & Request.QueryString("threadid"))

End Sub

Sub viewanswer()

Response.Redirect("Answers.aspx?threadid=" & Request.QueryString("threadid"))

End Sub

</script>

 



HTML Comment Box is loading comments...



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.