Guest User

Untitled

a guest
Jun 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. Dim strConnection As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
  2. Dim con As SqlConnection = New SqlConnection(strConnection)
  3. Dim cmd As SqlCommand = New SqlCommand
  4. Dim objDs As DataSet = New DataSet
  5. Dim dAdapter As SqlDataAdapter = New SqlDataAdapter
  6.  
  7. cmd.Connection = con
  8. cmd.CommandType = CommandType.Text
  9. cmd.CommandText = "SELECT distinct FIELD FROM TABLE order by FIELD"
  10.  
  11. dAdapter.SelectCommand = cmd
  12. con.Open()
  13. dAdapter.Fill(objDs)
  14. con.Close()
  15.  
  16. If (objDs.Tables(0).Rows.Count > 0) Then
  17.  
  18. lstDropdown.DataSource = objDs.Tables(0)
  19. lstDropdown.DataTextField = "FIELD"
  20. lstDropdown.DataValueField = "FIELD"
  21. lstDropdown.DataBind()
  22. lstDropdown.Items.Insert(0, "Please Select")
  23. lstDropdown2.Items.Insert(0, "Please Select")
  24.  
  25. Else
  26.  
  27. lblMessage.Text = "* Our Database seem to be down!"
  28.  
  29. End If
  30.  
  31. Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  32.  
  33. ?????????????????????????????????
  34.  
  35. End Try
  36.  
  37. End Sub
  38.  
  39. Public Class Person
  40.  
  41. private _firstName as string
  42. private _lastName as string
  43.  
  44. '''Constructor with no params
  45. public Sub New()
  46. _firstName = ""
  47. _lastName = ""
  48. End Sub
  49.  
  50. 'Contructor with params
  51. Public Sub New(FirstName as String, LastName as String)
  52. _firstName = FirstName
  53. _lastName = LastName
  54. End Sub
  55.  
  56. Public Property FirstName As String
  57. Get
  58. return _firstName
  59. End Get
  60. Set(value as String)
  61. _firstName = value
  62. End Set
  63. End Property
  64.  
  65. Public Property LastName As String
  66. Get
  67. return _lastName
  68. End Get
  69. Set(value as String)
  70. _lastName = value
  71. End Set
  72. End Property
  73.  
  74. Public Function HitHomeRun() As Boolean
  75. ....'Do some stuff here
  76. End Function
  77. End Class
  78.  
  79. Dim p as New Person()
  80. p.FirstName = "Mike"
  81. p.LastName = "Schmidt"
  82.  
  83. dim IsHomeRunHit As Boolean = p.HitHomeRun()
  84.  
  85. Public Shared Sub PopulateDropdowns(lstDropdown As DropDownList, lstDropdown2 As DropDownList)
  86.  
  87. ... here goes your code
  88.  
  89. End Sub
  90.  
  91. UIHelper.PopulateDropdowns(lstDropdown, lstDropdown2)
  92.  
  93. Public Class Common
  94.  
  95. Public Shared Sub MyMethod
  96. 'Do things.
  97. End Sub
  98.  
  99. End Class
  100.  
  101. Common.MyMethod
Add Comment
Please, Sign In to add comment