PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/e_desk/deletecategory.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 55 lines | 38 code | 13 blank | 4 comment | 0 complexity | 82b05772e90772f96d1db8df24f884f0 MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6    Partial Class deletecategory
 7        Inherits System.Web.UI.Page
 8
 9#Region " Web Form Designer Generated Code "
10
11        'This call is required by the Web Form Designer.
12        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
13
14        End Sub
15
16
17        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
18            'CODEGEN: This method call is required by the Web Form Designer
19            'Do not modify it using the code editor.
20            InitializeComponent()
21        End Sub
22
23#End Region
24
25        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
26            'Put user code to initialize the page here
27            If Not IsPostBack Then
28                Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
29                con.Open()
30                Dim str As String
31                str = "select categorycode from hdcategories"
32                Dim cmd As SqlCommand = New SqlCommand(str, con)
33                Dim dr As SqlDataReader
34                dr = cmd.ExecuteReader()
35                t5.DataSource = dr
36                t5.DataBind()
37                con.Close()
38            End If
39        End Sub
40
41        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
42            Dim s8 As String = t5.SelectedItem.Value
43
44            Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
45            con.Open()
46
47            Dim Str As String = "delete from hdcategories where categorycode='" + s8 + "'"
48
49            Dim cmd As SqlCommand
50            cmd = New SqlCommand(Str, con)
51            cmd.ExecuteNonQuery()
52            Response.Write(" Reocrd deleted")
53        End Sub
54    End Class
55End Namespace