Public ClassFrmNoticeBoard
InheritsSystem.Web.UI.Page
Dim con As NewOleDb.OleDbConnection
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private SubInitializeComponent()
End Sub
Protected WithEvents Label3 AsSystem.Web.UI.WebControls.Label
Protected WithEvents Label2 AsSystem.Web.UI.WebControls.Label
Protected WithEvents Label1 AsSystem.Web.UI.WebControls.Label
Protected WithEvents Button1 AsSystem.Web.UI.WebControls.Button
Protected WithEvents Label8 AsSystem.Web.UI.WebControls.Label
Protected WithEvents Label4 AsSystem.Web.UI.WebControls.Label
Protected WithEvents TxtMessage AsSystem.Web.UI.WebControls.TextBox
Protected WithEvents TxtUser AsSystem.Web.UI.WebControls.TextBox
Protected WithEvents TxtTeamName AsSystem.Web.UI.WebControls.TextBox
Protected WithEvents ComType AsSystem.Web.UI.WebControls.DropDownList
Protected WithEvents ComMember AsSystem.Web.UI.WebControls.DropDownList
Protected WithEvents DataGrid1 AsSystem.Web.UI.WebControls.DataGrid
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
PrivatedesignerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByValsender As System.Object, ByVal e AsSystem.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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
con.ConnectionString = Application("Con")
con.Open()
If Not Page.IsPostBack Then
TxtTeamName.Text = Session("Team")
TxtUser.Text = Session("MemID")
Dimadp As New OleDb.OleDbDataAdapter("Select * from Member where TName='" & Session("Team") & "'", con)
Dimdset As NewDataSet
adp.Fill(dset, "MEMBER")
ComMember.DataSource = dset.Tables(0)
ComMember.DataValueField = "MEMID"
ComMember.DataTextField = "MEMID"
ComMember.DataBind()
ComMember.Items.Remove(TxtUser.Text)
Dimquery As String
query = "Select * from NoticeBoard where VType =0 or VMemID='" & TxtUser.Text & "'"
Dimdad As NewOleDb.OleDbDataAdapter(query, con)
Dimds As NewDataSet
dad.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
End If
End Sub
Private Sub ComType_SelectedIndexChanged(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs) HandlesComType.SelectedIndexChanged
ComMember.Visible = False
IfComType.SelectedIndex = 2 ThenComMember.Visible = True
End Sub
Private Sub Button1_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
IfTxtMessage.Text.Length < 0 Then Exit Sub
Try
Dimcmd As NewOleDb.OleDbCommand
cmd.Connection = con
DimQuery As String
Query = "Insert into NoticeBoard Values (" & SValue(TxtTeamName.Text) & ","
Query = Query & SValue(TxtUser.Text) & ","
IfComType.SelectedIndex = 2 Then
Query = Query & SValue(ComMember.SelectedValue) & ","
Else
Query = Query & "null,"
EndIf
Query = Query & ComType.SelectedIndex & ","
Query = Query & SValue(TxtMessage.Text) & ")"
Label8.Text = Query
cmd.CommandText = Query
cmd.ExecuteNonQuery()
Label8.Text = "Information Posted"
Catchex As Exception
Label8.Text = ex.Message
End Try
End Sub
End Class
No comments:
Post a Comment