PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 35ms app.codeStats 1ms

/e_desk/closeproblem_user.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 61 lines | 42 code | 15 blank | 4 comment | 0 complexity | e1df95210560d428f0c18aa6881dcb93 MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6
 7Partial Class closeproblem_user
 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        If Not IsPostBack Then
31            Dim str As String
32            str = "select problemid from problems_master where userid='" + Session("username") + "' and status = 'Open'"
33            Dim cmd1 As SqlCommand = New SqlCommand(str, con)
34            Dim dr As SqlDataReader
35            dr = cmd1.ExecuteReader()
36            t5.DataSource = dr
37            t5.DataBind()
38        End If
39        con.Close()
40        con.Open()
41        Dim cmd As New SqlCommand("select * from Problems_master where userid = '" + Session("username") + "'", con)
42        DataGrid1.DataSource = cmd.ExecuteReader
43        DataGrid1.DataBind()
44    End Sub
45
46    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
47        Dim s8 As String = t5.SelectedItem.Value
48
49        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
50        con.Open()
51
52        Dim Str As String = "update problems_master set status='Close' where problemid=" + s8
53
54        Dim cmd As SqlCommand
55        cmd = New SqlCommand(Str, con)
56        cmd.ExecuteNonQuery()
57        Response.Write(" Reocrd deleted")
58    End Sub
59End Class
60
61End Namespace