0
Imports System.Data.OleDb
Namespace wbdsproject
Partial Class frmUserPrvMsg
Inherits System.Web.UI.Page
Dim topicDb As OleDbConnection
Dim topicCmd As OleDbCommand
Dim topicReader As OleDbDataReader
Dim topicId As Integer
Dim AuthorName, Username As String
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
'Put user code to initialize the page here
Dim uid As Int16
topicId = Request.QueryString("topicId")
topicDb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\discussion\SampleForum.mdb")
topicDb.Open()
If Session("loginuser") = "" Then
Response.Redirect("frmlogin.aspx")
End If
Username = Session("loginuser")
topicCmd = New OleDbCommand("select uid from tbllog where uname='" & Username & "'", topicDb)
uid = topicCmd.ExecuteScalar
topicCmd = New OleDbCommand("Select uname,pMsgDate,pMsgSubject,pMsgDetail from tblprivatemessage, tbllog where tblprivatemessage.pMsgTo=" & uid & " and tbllog.uid=tblprivatemessage.pMsgFrom", topicDb)
topicReader = topicCmd.ExecuteReader
DataGrid2.DataSource = topicReader
DataGrid2.DataBind()
topicReader.Close()
End Sub
Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btninbox_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btninbox.Click
Response.Redirect("frmUserPrvMsg.aspx")
End Sub
Private Sub btnOutBox_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnOutBox.Click
Response.Redirect("OutBox.aspx")
End Sub
End Class
End Namespace
初學者,只需我運行無法理解unknoen problem.any soutions從'DBNull'類型到'Short'類型的轉換無效。在.NET .NET
而一個DBNull的結果意味着存在具有指定名稱的用戶。 – 2015-02-24 08:31:54