/e_desk/categorymenu_hd.aspx.vb
Visual Basic | 70 lines | 50 code | 16 blank | 4 comment | 0 complexity | 6dfd6af81291a233d5dbf97319a63c7d MD5 | raw file
1Imports System.Data 2Imports System.Data.SqlClient 3 4 5Namespace e_desk 6 7Partial Class categorymenu_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 categorycode,categoryname,status from hdcategories", 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 categorycode from hdcategories" 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 hdcategories set description='" + s4 + "', status = '" + s3 + "' where categorycode='" + 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 Label1.Text = s1 + " Category " + s3 + " sucessfully" 65 Label1.Visible = True 66 con.Close() 67 End Sub 68End Class 69 70End Namespace