Monday, 30 July 2012

Code for Member Registration IN OCS


Public ClassRegMemeber
    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 Sub InitializeComponent()

    End Sub
    Protected WithEvents TextBox3 AsSystem.Web.UI.WebControls.TextBox
    Protected WithEvents Label6 AsSystem.Web.UI.WebControls.Label
    Protected WithEvents Label4 AsSystem.Web.UI.WebControls.Label
    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 TxtLocation AsSystem.Web.UI.WebControls.TextBox
    Protected WithEvents TxtDesignation AsSystem.Web.UI.WebControls.TextBox
    Protected WithEvents TxtPassword AsSystem.Web.UI.WebControls.TextBox
    Protected WithEvents TxtMemberID AsSystem.Web.UI.WebControls.TextBox

    '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
        con.ConnectionString = Application("Con")
        con.Open()
    End Sub

    Private Sub Button1_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
        IfSession("Member") = TxtMemberID.Text Then
            Label8.Text = "Already Information is Posted"
            ExitSub
        End If
        Try
            Dimcmd As NewOleDb.OleDbCommand
            cmd.Connection = con
            Dimquery As String
            query = "Insert into Member Values("
            query = query & SValue(Session("Team")) & ","
            query = query & SValue(TxtMemberID.Text) & ","
            query = query & SValue(TxtPassword.Text) & ","
            query = query & SValue(TxtDesignation.Text) & ","
            query = query & SValue(TxtLocation.Text) & ","
            query = query & "'Member')"
            cmd.CommandText = query
            cmd.ExecuteNonQuery()
            Label8.Text = "The Given Information is Posted"
            Session("Member") = TxtMemberID.Text
        Catchex As Exception
            Label8.Text = ex.Message
        End Try
    End Sub
End Class

No comments:

Post a Comment