PageRenderTime 278ms CodeModel.GetById 111ms app.highlight 73ms RepoModel.GetById 89ms app.codeStats 0ms

/e_desk/modulesmenu_hd.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 70 lines | 50 code | 16 blank | 4 comment | 0 complexity | 7358a19196f6c62824f771a7495f4c8b MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6
 7Partial Class modulesmenu_hd
 8    Inherits System.Web.UI.Page
 9
10#Region " Web Form Designer Generated Code "
11
12    'This call is required by the Web Form Designer.
13    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
14
15    End Sub
16
17
18    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
19        'CODEGEN: This method call is required by the Web Form Designer
20        'Do not modify it using the code editor.
21        InitializeComponent()
22    End Sub
23
24#End Region
25
26    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
27        'Put user code to initialize the page here
28        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
29        con.Open()
30        Dim cmd As New SqlCommand("select modulecode,modulename,status from hdmodules", con)
31        DataGrid1.DataSource = cmd.ExecuteReader
32        DataGrid1.DataBind()
33
34        con.Close()
35        con.Open()
36        If Not IsPostBack Then
37            Dim str As String
38            str = "select modulecode from hdmodules"
39            Dim cmd1 As SqlCommand = New SqlCommand(str, con)
40            Dim dr As SqlDataReader
41            dr = cmd1.ExecuteReader()
42            mt1.DataSource = dr
43            mt1.DataBind()
44            con.Close()
45        End If
46    End Sub
47
48    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
49        Dim s1, s2, s3, s4, s5, s6, s7, s8, str As String
50        s1 = mt1.SelectedItem.Value
51        s3 = mt3.SelectedItem.Value
52        s4 = mt4.Text
53
54        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
55        con.Open()
56
57        str = "update hdmodules set description='" + s4 + "', status = '" + s3 + "' where modulecode='" + s1 + "'"
58
59        Dim cmd As SqlCommand
60        cmd = New SqlCommand(str, con)
61        cmd.ExecuteNonQuery()
62        DataGrid1.Visible = False
63        p4.Visible = False
64        Label2.Text = s1 + " Module " + s3 + " sucessfully"
65        Label2.Visible = True
66        con.Close()
67    End Sub
68End Class
69
70End Namespace