PageRenderTime 47ms CodeModel.GetById 43ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/e_desk/deletehduser.aspx.vb

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