Sunday, 11 August 2013
How to add items in your Combo Box from Database Connection?
Imports System.Data.SqlClient
Public Class Adding_itemsOfComboBox_From_Database
Dim dr As SqlDataReader
Private Sub Adding_itemsOfComboBox_From_Database_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Using conn = Opencon()
Dim cmd As New SqlCommand("Select FIRSTNAME from PATIENT_INFO", conn)
dr = cmd.ExecuteReader
While dr.Read
cboClientName.Items.Add(dr(0))
End While
End Using
End Sub
End Class
Note:
"Using conn=Opencon()" is a function use as the global declaration of Database Connection. Click here to learn about it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment