/e_desk/modulesmenu_hd.aspx.vb

http://github.com/shafiqissani/eDesk-Systems · Visual Basic · 70 lines · 50 code · 16 blank · 4 comment · 0 complexity · 7358a19196f6c62824f771a7495f4c8b MD5 · raw file

  1. Imports System.Data
  2. Imports System.Data.SqlClient
  3. Namespace e_desk
  4. Partial Class modulesmenu_hd
  5. Inherits System.Web.UI.Page
  6. #Region " Web Form Designer Generated Code "
  7. 'This call is required by the Web Form Designer.
  8. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  9. End Sub
  10. Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  11. 'CODEGEN: This method call is required by the Web Form Designer
  12. 'Do not modify it using the code editor.
  13. InitializeComponent()
  14. End Sub
  15. #End Region
  16. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  17. 'Put user code to initialize the page here
  18. Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
  19. con.Open()
  20. Dim cmd As New SqlCommand("select modulecode,modulename,status from hdmodules", con)
  21. DataGrid1.DataSource = cmd.ExecuteReader
  22. DataGrid1.DataBind()
  23. con.Close()
  24. con.Open()
  25. If Not IsPostBack Then
  26. Dim str As String
  27. str = "select modulecode from hdmodules"
  28. Dim cmd1 As SqlCommand = New SqlCommand(str, con)
  29. Dim dr As SqlDataReader
  30. dr = cmd1.ExecuteReader()
  31. mt1.DataSource = dr
  32. mt1.DataBind()
  33. con.Close()
  34. End If
  35. End Sub
  36. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  37. Dim s1, s2, s3, s4, s5, s6, s7, s8, str As String
  38. s1 = mt1.SelectedItem.Value
  39. s3 = mt3.SelectedItem.Value
  40. s4 = mt4.Text
  41. Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
  42. con.Open()
  43. str = "update hdmodules set description='" + s4 + "', status = '" + s3 + "' where modulecode='" + s1 + "'"
  44. Dim cmd As SqlCommand
  45. cmd = New SqlCommand(str, con)
  46. cmd.ExecuteNonQuery()
  47. DataGrid1.Visible = False
  48. p4.Visible = False
  49. Label2.Text = s1 + " Module " + s3 + " sucessfully"
  50. Label2.Visible = True
  51. con.Close()
  52. End Sub
  53. End Class
  54. End Namespace