PageRenderTime 203ms CodeModel.GetById 161ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 1ms

/e_desk/problemsmenu_hd.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 69 lines | 50 code | 15 blank | 4 comment | 0 complexity | aa90853238e88812c78ae52afe68b4bc MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6
 7Partial Class problemsmenu_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
31        Dim str As String = "select * from problems_master where status='Open'"
32        If Not IsPostBack Then
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(str, 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 con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
48        con.Open()
49
50        Dim s1, s2, s3, s4, s5, s6 As String
51        s1 = t5.SelectedItem.Value
52        s2 = t1.Text
53
54        s3 = "select userid from problems_master where problemid = " + s1
55        Dim cmd As SqlCommand = New SqlCommand(s3, con)
56        Dim dr As SqlDataReader = cmd.ExecuteReader()
57        dr.Read()
58        s4 = dr.GetValue(0)
59        dr.Close()
60        con.Close()
61        con.Open()
62        s5 = "insert into problem_solution values('" + s1 + "','" + s2 + "','" + Session("username") + "','" + s4 + "','Open')"
63        Dim cmd1 As SqlCommand = New SqlCommand(s5, con)
64        cmd1.ExecuteNonQuery()
65        Response.Write("Solution posted...")
66        End Sub
67End Class
68
69End Namespace